Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public void SaveComment(ObjectId postId,Comment comment)
 {
     comment.CommentId = ObjectId.GenerateNewId();
     comment.Date = DateTime.Now;
     Context.Post.SaveComment(postId,comment);
 }