public void AddComment(ObjectId postId, Comment comment)
 {
     _posts.Collection.Update(Query.EQ("_id", postId),
         Update.PushWrapped("Comments", comment).Inc("TotalComments", 1));
 }
        public ActionResult AddComment(ObjectId postId, Comment comment)
        {
            if (ModelState.IsValid)
            {
                var newComment = new Comment()
                                        {
                                            CommentId = ObjectId.GenerateNewId(),
                                            Author = User.Identity.Name,
                                            Date = DateTime.Now,
                                            Detail = comment.Detail
                                        };

                _commentService.AddComment(postId, newComment);

                ViewBag.PostId = postId;
                return Json(
                    new
                        {
                            Result = "ok",
                            CommentHtml = RenderPartialViewToString("Comment", newComment),
                            FormHtml = RenderPartialViewToString("AddComment", new Comment())
                        });
            }

            ViewBag.PostId = postId;
            return Json(
                new
                    {
                        Result = "fail",
                        FormHtml = RenderPartialViewToString("AddComment", comment)
                    });
        }