public ActionResult Put(int id, TodoViewModel newTodo)
 {
     Todo todo = repository.Get(id);
     UpdateModel(todo, new[] { "Text", "Done", "Order" });
     ValidateModel(todo);
     repository.Save();
     return Json(new TodoViewModel(todo));
 }
 public ActionResult Post(TodoViewModel newTodo)
 {
     Todo todo = new Todo();
     UpdateModel(todo, new[] { "Text", "Done", "Order" });
     ValidateModel(todo);
     repository.Add(todo);
     repository.Save();
     return Json(new TodoViewModel(todo));
 }
예제 #3
0
 public SaveViewModel(TodoListViewModel parentVM)
 {
     parentViewModel = parentVM;
     IsEdit          = false;
 }