Пример #1
0
 public ActionResult Comment(int postId)
 {
     var model=new CommentModel()
     {
         PostId = postId
     };
     return PartialView("Comment", model);
 }
Пример #2
0
 public ActionResult CreateComment(CommentModel model)
 {
     model.UserId = User.Identity.GetId();
     var comment = Mapper.Map(model, new Comment());
     if (ModelState.IsValid)
     {
         _commentService.Create(comment);
     }
     return RedirectToAction("Detail", new { id = comment.PostId });
 }