Example #1
0
        public async Task <IActionResult> AddComment(SinglePostModel model)
        {
            var commentModel = new CommentModel();

            commentModel.BlogId      = model.Id;
            commentModel.Name        = model.CommenterName;
            commentModel.Email       = model.CommenterEmail;
            commentModel.Description = model.CommentDescription;
            try
            {
                await commentModel.PostComment();

                _logger.LogInformation("Comment Added Successfully");
            }
            catch (Exception ex)
            {
                _logger.LogInformation(ex.Message);
            }

            return(RedirectToAction("SingleBlog", "Blog", new { @id = model.Id }));
        }