public ActionResult Update(EditViewModel model) { if (!ModelState.IsValid) { return View("Edit", model); } var entity = _repository.GetTodo(model.Id); entity.Title = model.Title; entity.Item = model.Entry; _repository.Update(entity); return RedirectToAction("Index"); }
public ActionResult Edit(int id) { var entity = _repository.GetTodo(id); var model = new EditViewModel { Id = 1, Title = entity.Title, Entry = entity.Item }; return View(model); }