public ActionResult Archive(string id, FormCollection collection) { ArchiveScreen screen = new ArchiveScreen(id); TryUpdateModel(screen); screen.HandleUserInput(); if (screen.IsSpam) { screen.LogSpam(); } else if (screen.IsValid) { ModelState.Clear(); screen.SaveAndProcessFeedback(); //reload data screen = new ArchiveScreen(id); return Redirect(Url.Content("~/" + screen.BlogEntryScreen.BlogEntry.EntryName)); } else { screen.Message = "Oops - there was a problem."; //Add our validation errors foreach (var item in screen.GetValidationErrors()) { ModelState.AddModelError(item.Key, item.Value); } } ViewData.Model = screen; return View(); }
public ActionResult Archive(string id) { id = EntryTitleLogic.GetEntryNameFromTitle(id); ArchiveScreen screen = new ArchiveScreen(id); ViewData.Model = screen; //The id didn't produce a valid blog entry if (screen.BlogEntryScreen.BlogEntry == null) return RedirectToAction("NotFound", "Error"); try { screen.UpdateEntryViewCount(); } catch (Exception ex) { LoggingHandler.Log(ex, "BlogController.UpdateEntryViewCount"); } return View(); }