public ActionResult Post(ObjectId postId, Comment comment) { Post post = _postService.GetOnePost(postId); if (post == null) { return new HttpNotFoundResult(); } if (TryValidateModel(comment)) { _postService.SaveComment(postId, comment); return RedirectToAction("post", new { id = post.Url }); } return View(post); }
public void SaveComment(ObjectId postId,Comment comment) { comment.CommentId = ObjectId.GenerateNewId(); comment.Date = DateTime.Now; Context.Post.SaveComment(postId,comment); }