Пример #1
0
 public ActionResult Update(TodoForm form)
 {
     if (ModelState.IsValid) {
         var todo = Map(form);
         Api.Post<TodosResponse>("/todos", new Todos{ Todo = todo });
         return RedirectToAction("Index");
     }
     TempData["errors"] = ModelState;
     return RedirectToAction("Edit");
 }
Пример #2
0
 public ActionResult New()
 {
     var form = new TodoForm();
     return View(form);
 }
Пример #3
0
 private Todo Map(TodoForm form)
 {
     return new Todo { Id = form.Id, Body = form.Body, Done = form.Done, Order = form.Order };
 }