예제 #1
0
 public static IEnumerable<TodoTask> GetTasks()
 {
     using (TodoContext ctx = new TodoContext())
     {
         return ctx.Tasks.ToList();
     }
 }
예제 #2
0
 public static void CreateTask(TodoTask task)
 {
     using (TodoContext ctx = new TodoContext())
     {
         ctx.Tasks.Add(task);
         ctx.SaveChanges();
     }
 }