public ActionResult Create(EditPageModel model) { if (ModelState.IsValid) { var page = new Page(); model.MapTo(page); _repository.Add(page); _repository.SaveAllChanges(); return RedirectToAction("Index"); } return View(model); }
public ActionResult Edit(int id, EditPageModel model) { if (ModelState.IsValid) { var page = GetPage(id); model.MapTo(page); _repository.SaveAllChanges(); return RedirectToAction("Index"); } return View(model); }