Exemple #1
0
 public void DeleteTask(int id)
 {
     using (var db = new TasksContext())
     {
         db.Entry(db.Tasks.FirstOrDefault(s => s.Id == id)).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
     }
 }
Exemple #2
0
 public Task UpdateTask(Task task)
 {
     using (var db = new TasksContext())
     {
         db.Entry(task).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(task);
     }
 }