public ActionResult AddComment(InputCommentViewModelCreate model) { if (model != null && this.ModelState.IsValid) { var comment = this.Mapper.Map<Comment>(model); comment.UserId = this.UserProfile.Id; comment = this.commentsService.AddNew(comment); var viewModel = this.Mapper.Map<CommentViewModel>(comment); viewModel.UserName = this.UserProfile.UserName; return this.PartialView("~/Views/Comment/_SingleCommentPartial.cshtml", viewModel); } throw new HttpException(400, "Invalid Comment"); }
public ActionResult AddComment(InputCommentViewModelCreate model) { if (model != null && this.ModelState.IsValid) { var comment = this.Mapper.Map <Comment>(model); comment.UserId = this.UserProfile.Id; comment = this.commentsService.AddNew(comment); var viewModel = this.Mapper.Map <CommentViewModel>(comment); viewModel.UserName = this.UserProfile.UserName; return(this.PartialView("~/Views/Comment/_SingleCommentPartial.cshtml", viewModel)); } throw new HttpException(400, "Invalid Comment"); }