public ActionResult Update(Section section) { if (!ModelState.IsValid) return View("Edit", section); if (section.Position == 0) { section.Position = RavenSession.Query<Section>() .OrderByDescending(sec => sec.Position) .Select(sec => sec.Position) .FirstOrDefault() + 1; } RavenSession.Store(section); return RedirectToAction("Index"); }
public virtual ActionResult Update(Section section) { if (!ModelState.IsValid) return View("Edit", section); if (section.Position == 0) { section.Position = RavenSession.Query<Section>() .OrderByDescending(sec => sec.Position) .Select(sec => sec.Position) .FirstOrDefault() + 1; } RavenSession.Store(section); OutputCacheManager.RemoveItems(MVC.Section.Name); return RedirectToAction("Index"); }
public ActionResult Update(Section input) { if (!ModelState.IsValid) return View("Edit", input); var section = RavenSession.Load<Section>(input.Id) ?? new Section(); input.MapPropertiesToInstance(section); if (section.Position == 0) { section.Position = RavenSession.Query<Section>() .Select(sec => sec.Position) .OrderByDescending(position => position) .FirstOrDefault() + 1; } RavenSession.Store(section); return RedirectToAction("List"); }