public void DeleteTask(Task task) { var taskToDelete = GetTaskById(task.Id); if (taskToDelete != null) { base.EbalitDBContext.Tasks.Remove(taskToDelete); base.EbalitDBContext.SaveChanges(); } }
public void UpdateTask(Task task) { var taskToUpdate = GetTaskById(task.Id); if (taskToUpdate != null) { base.EbalitDBContext.Entry(taskToUpdate).CurrentValues.SetValues(task); base.EbalitDBContext.SaveChanges(); } }
public int CreateTask(Task task) { base.EbalitDBContext.Tasks.Add(task); base.EbalitDBContext.SaveChanges(); return task.Id; }