public ActionResult Edit(int id) { SessionStatus(); var post = _blog.GetPostById(id); if (post != null) { return View(post); } else { return RedirectToAction("Index"); } }
public async Task <IActionResult> Detail(string id, string name) { BlogPost post = await blog.GetPostById(id); if (post == null) { return(RedirectToAction("Index")); } return(View(post)); }
public async Task <IActionResult> EditPost(string postId) { BlogPost post = await blogService.GetPostById(postId); if (post != null) { EditPostViewModel viewModel = new EditPostViewModel(); viewModel.BlogPostID = postId; viewModel.Title = post.Title; viewModel.Content = post.Content; viewModel.Comments = post.Comments; viewModel.IsPublished = post.IsPublished; return(View(viewModel)); } return(RedirectToAction("NewPost", "Admin")); }
public ActionResult Detail(int id) { SessionStatus(); return(View(_blog.GetPostById(id))); }
public ActionResult Details(int id) { return(View(_blog.GetPostById(id))); }