public ActionResult AddNewComment(CommentViewModel model) { var comment = new Comment { Content = model.Content, OwnerName = model.OwnerName, Created = DateTime.Now, PostId = model.PostId }; _postRepository.AddCommentToPost(comment, model.PostId); return(RedirectToPost(model.PostId)); }
public ViewResult LeaveComment(Comment comment) { comment.CreationTime = DateTime.Now; if (ModelState.IsValid) { PostRepository.AddCommentToPost(comment, comment.PostId); MessagingService.Contact = new Contact { Name = comment.Author, Email = comment.Email, Message = comment.Content, Subject = "comment to moderate post id: " + comment.PostId //ToDo - Test This }; MessagingService.Message(); } else { return(View("_CommentSubmittedFailed")); } return(View("_CommentSubmitted")); }