public ViewResult EditComment(int commentID) { ViewBag.Title = Resources.EditComment; Comment comment = repoComment.Comment(commentID: commentID, enabled: false); return(View(comment)); }
public IActionResult Comment(CommentViewModel model) { if (ModelState.IsValid) { var Comment = new BlogComments() { UserName = model.UserName, UserId = userManager.GetUserId(User), BlogPostId = model.PostId, Body = model.Comment, TimeOfComment = DateTime.Now, UserPicture = model.ProfilePicture, }; _commentRepository.Comment(Comment); _blogPostRepository.GetBlogPost(model.PostId).NumberOfComments = context.BlogComments.Where(x => x.BlogPostId == model.PostId).Count(); context.SaveChanges(); return(RedirectToAction("Details", new { id = Comment.BlogPostId })); } return(View()); }