public IActionResult Create(BlogManagementCreateModel model) { if (!ModelState.IsValid) { throw new Exception(); } var title = model.Title.Trim(); var entry = _blogEntryRepository.Create(new BlogEntry() { Title = title, Key = title.UrlKey(), BlogPublishDateTimeUtc = DateTime.UtcNow }); if (entry.BlogEntryId > 0) { return(RedirectToAction("Edit", new { blogEntryId = entry.BlogEntryId })); } else { return(View(entry)); } }
public IActionResult Create() { var model = new BlogManagementCreateModel(); return(View(model)); }