public ActionResult Edit(string titleUrl, ExampleDetailEM editModel) { if (!ModelState.IsValid) return View("Edit"); var detail = Session.Query<Example>().Single(d => d.TitleUrl == titleUrl); Mapper.Map(editModel, detail); return RedirectToAction("Detail", new {id = detail.TitleUrl}); }
public ActionResult Create(ExampleDetailEM editModel) { if (!ModelState.IsValid) return View("Edit"); var detail = Mapper.Map<Example>(editModel); detail.Node = new Node(); detail.CreatedAt = DateTime.UtcNow; Session.Store(detail); return RedirectToAction("Detail", new {id = detail.TitleUrl}); }