public IHttpActionResult PutFeedback(int id, Feedback feedback) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != feedback.FeedbackID) { 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.Feedback.Add(feedback); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = feedback.FeedbackID }, feedback); }