public async Task <IActionResult> BlogArticle(int id) { var content = await this.blogService.GetBlogContent <BlogContentView>(id); if (content == null) { return(this.NotFound()); } var viewModel = new BlogArticleBindingViewModel { BlogContentView = content, }; return(this.View(viewModel)); }
public async Task <IActionResult> PostComment(BlogArticleBindingViewModel input) { if (!this.ModelState.IsValid) { return(this.RedirectToAction( "BlogArticle", "Blog", new { id = input.CommentInputModel.BlogId })); } // If the state is valid create a comment for the current blog. await this.commentService.Create( input.CommentInputModel.BlogContentId, input.CommentInputModel.Name, input.CommentInputModel.Email, input.CommentInputModel.Content); return(this.RedirectToAction( "BlogArticle", "Blog", new { id = input.CommentInputModel.BlogId })); }