public IHttpActionResult PutFeedback(int id, Feedback feedback) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != feedback.ID) { return BadRequest(); } db.Entry(feedback).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FeedbackExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostFeedback(Feedback feedback) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Feedbacks.Add(feedback); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = feedback.ID }, feedback); }