public ActionResult AddComment(TvShowCommentInputModel comment) { if (!this.User.Identity.IsAuthenticated) { this.Response.StatusCode = 401; return(this.Content("Access is denied")); } if (comment == null || !this.ModelState.IsValid) { this.Response.StatusCode = 400; return(this.Content("Bad request")); } var newComment = this.comments.Add(comment.Content, comment.TvShowId, this.User.Identity.GetUserId()); if (newComment == null) { this.Response.StatusCode = 400; return(this.Content("Bad request.")); } var viewModel = this.Mapper.Map <TvShowCommentViewModel>(newComment); return(this.PartialView("_TvShowComment", viewModel)); }
public ActionResult AddComment(int id) { var viewModel = new TvShowCommentInputModel() { Content = string.Empty, TvShowId = id }; return(this.PartialView("_AddComment", viewModel)); }