public ActionResult Comment(int postId) { var model=new CommentModel() { PostId = postId }; return PartialView("Comment", model); }
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 }); }