public ActionResult Post(EditPostViewModel model) { var postId = BlogService.CreateOrUpdatePost(new Models.PostModel { BlogId = model.BlogId.Value, Body = model.Body, Identifier = model.Identifier, PostId = model.PostId, Title = model.Title, UrlTitle = model.UrlTitle, PublishDate = model.PublishDate, IsDraft = model.IsDraft }); return RedirectToAction("Posts"); }
public PartialViewResult PreviewMarkdown(EditPostViewModel model) { var result = new Post { Title = model.Title, PostDate = DateTime.UtcNow, RawBody = model.Body }; return PartialView("../Blog/Post", result); }
public ActionResult Post(int? postId) { EditPostViewModel viewModel; if (postId.HasValue) { var model = BlogService.GetPost(postId.Value); viewModel = new EditPostViewModel { Body = model.Body, CreatedDate = model.CreatedDate, Identifier = model.Identifier, ModifedDate = model.ModifedDate, PostId = model.PostId, Title = model.Title, BlogId = model.BlogId, UrlTitle = model.UrlTitle, PublishDate = model.PublishDate, IsDraft = model.IsDraft }; } else { viewModel = new EditPostViewModel { PostId = null, Identifier = Guid.NewGuid(), BlogId = null }; } return View(viewModel); }