//Delete a task in the db
 public static void DeleteTask(int taskId)
 {
     RoleClaimContext db = new RoleClaimContext();
     Task task = db.Tasks.Find(taskId);
     db.Tasks.Remove(task);
     db.SaveChanges();
 }
 //Update an existing task in the db.
 public static void UpdateTask(int taskId, string status)
 {
     RoleClaimContext db = new RoleClaimContext();
     Task task = db.Tasks.Find(taskId);
     task.Status = status;
     db.SaveChanges();
 }
コード例 #3
0
        //Delete a task in the db
        public static void DeleteTask(int taskId)
        {
            RoleClaimContext db   = new RoleClaimContext();
            Task             task = db.Tasks.Find(taskId);

            db.Tasks.Remove(task);
            db.SaveChanges();
        }
コード例 #4
0
        //Update an existing task in the db.
        public static void UpdateTask(int taskId, string status)
        {
            RoleClaimContext db   = new RoleClaimContext();
            Task             task = db.Tasks.Find(taskId);

            task.Status = status;
            db.SaveChanges();
        }
 // Add a task to the db.
 public static void AddTask(string taskText)
 {
     RoleClaimContext db = new RoleClaimContext();
     Task newTask = new Task
     {
         Status = "NotStarted",
         TaskText = taskText
     };
     db.Tasks.Add(newTask);
     db.SaveChanges();
 }
コード例 #6
0
        // Add a task to the db.
        public static void AddTask(string taskText)
        {
            RoleClaimContext db      = new RoleClaimContext();
            Task             newTask = new Task
            {
                Status   = "NotStarted",
                TaskText = taskText
            };

            db.Tasks.Add(newTask);
            db.SaveChanges();
        }
コード例 #7
0
        // Get all tasks from the db.
        public static List <Task> GetAllTasks()
        {
            RoleClaimContext db = new RoleClaimContext();

            return(db.Tasks.ToList());
        }
 // Get all tasks from the db.
 public static List<Task> GetAllTasks()
 {
     RoleClaimContext db = new RoleClaimContext();
     return db.Tasks.ToList();
 }