示例#1
0
 public ActionResult Edit(int id)
 {
     SessionStatus();
     var post = _blog.GetPostById(id);
     if (post != null)
     {
         return View(post);
     } else
     {
         return RedirectToAction("Index");
     }
 }
示例#2
0
        public async Task <IActionResult> Detail(string id, string name)
        {
            BlogPost post = await blog.GetPostById(id);

            if (post == null)
            {
                return(RedirectToAction("Index"));
            }


            return(View(post));
        }
示例#3
0
        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)));
 }
示例#5
0
 public ActionResult Details(int id)
 {
     return(View(_blog.GetPostById(id)));
 }