public IHttpActionResult PostComment(CommentsBindingModel comment, int id) { if (!ModelState.IsValid) { throw new Exception(); } var username = this.User.Identity.Name; var user = this.usersService.GetByName(username); var movie = this.movieService.GetById(id); this.service.Add(user, movie.Id, comment.Text); return this.Created("api/movies/{id}"+ movie.Id,MovieDetailViewModel.FromMovie.Compile().Invoke(movie)); }
public IHttpActionResult PostComment(CommentsBindingModel comment, int id) { if (!ModelState.IsValid) { throw new Exception(); } var username = this.User.Identity.Name; var user = this.usersService.GetByName(username); var movie = this.movieService.GetById(id); this.service.Add(user, movie.Id, comment.Text); return(this.Created("api/movies/{id}" + movie.Id, MovieDetailViewModel.FromMovie.Compile().Invoke(movie))); }