// POST /api/reviews public HttpResponseMessage Post(ReviewRequestModel model) { if (ModelState.IsValid) { Review r = Reviews.CreateReview(model.Title, model.Description, User.Identity.UserId); return Created(new { Id = r.Id, Href = Url.Resource(r) }); } return ValidationErrors(); }
// POST /api/reviews public HttpResponseMessage Post(ReviewRequestModel model) { Requires.NotNull(model, "model"); if (ModelState.IsValid) { Review r = Reviews.CreateReview(model.Title, model.Description, User.Identity.UserId); return Created(new ReviewModel() { Id = r.Id, Title = r.Name, Author = UserModel.FromUser(User) }); } return ValidationErrors(); }