namespace todoaspnet.Models { public class TodoModel { private static int _lastid = 0; public int ToDoId { get; set; } public string ToDoName { get; set; } public string ToDoDescription { get; set;} public DateTime DueDateTime { get; set; } public DateTime AddedAt { get;} public static int GetLastId () { return _lastid; } public static void ResetLastId() { _lastid = 0; } public static void SetLastId(int value) { _lastid = value; } public TodoModel() { var newId=Interlocked.Increment(ref _lastid); ToDoId = newId; AddedAt=DateTime.Now; } } }