public IHttpActionResult PutReview(int id, Review review) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != review.ID) { return BadRequest(); } db.Entry(review).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ReviewExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostReview(Review review) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Reviews.Add(review); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = review.ID }, review); }