public ActionResult Edit(int id) { var model = new PageEditModel(); model.Referrer = Request.UrlReferrer; var page = repository.Get<Page>(x => x.Id == id); model.Page = new EditablePage {Id = id, Title = page.Title, Content = page.Content }; return View(model); }
public ActionResult Edit(PageEditModel model) { var page = repository.Get<Page>(x => x.Id == model.Page.Id); page.Content = model.Page.Content; repository.Save(page); repository.Dispose(); return Redirect(model.Referrer.AbsoluteUri); }