예제 #1
0
 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);
 }
예제 #2
0
 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);
 }