public ActionResult Edit(EntryInput input) { var entry = _entryService.Single(input.Slug); input.MapPropertiesToInstance(entry); _entryService.Update(entry); ViewBag.EntryLink = LinkToEntry(entry.Slug); return View("Add", input); }
public ActionResult Add(EntryInput model) { if (ModelState.IsValid) { var entry = Mapper.Map<Entry>(model); var success = _entryService.Add(entry); if (success) { ViewBag.EntryLink = LinkToEntry(entry.Slug); RefreshEntryCount(); return View(); } ModelState.AddModelError("", "You have previously published a blog entry with this slug. Please choose another one."); } return View(model); }