public ActionResult AddPost(BlogPost post) { if (ModelState.IsValid) { post.PublishedAt = DateTime.Now; postsService.Add(post); return(RedirectToAction("Index", "Home")); } var model = new AddPostPageModel(); return(View("AddPost", model)); }
public ActionResult AddPost() { var model = new AddPostPageModel(); return(View(model)); }