Пример #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"));
        }
Пример #4
0
 public ActionResult Detail(int id)
 {
     SessionStatus();
     return(View(_blog.GetPostById(id)));
 }
Пример #5
0
 public ActionResult Details(int id)
 {
     return(View(_blog.GetPostById(id)));
 }