public List <ToDo> GetAll() { var context = new ToDoContext(); var result = context.Find <List <ToDo> >(); return(result); }
public ToDo GetById(int id) { var context = new ToDoContext(); var result = context.Find <ToDo>(id); return(result); }
public void DeleteTodo(int id) { using (var context = new ToDoContext()) { var toDelete = context.Find <ToDo>(id); context.ToDos.Remove(toDelete); context.SaveChanges(); } }