public async Task <IActionResult> AddComment(string postId, CommentVM comment) { var post = await _blog.GetPostById(postId); if (!ModelState.IsValid) { return(View("Post", post)); } if (post == null || !PostModule.AreCommentsOpen(post, _settings.Value.CommentsCloseAfterDays)) { return(NotFound()); } var cleanComment = CommentVMModule.toComment(comment); // the website form key should have been removed by javascript // unless the comment was posted by a spam robot if (!Request.Form.ContainsKey("website")) { post = PostModule.AddComment(cleanComment, post); await _blog.SavePost(post); } return(Redirect(PostModule.GetLink(post) + "#" + cleanComment.ID)); }