public IHttpActionResult PutFeedbackPost(int id, FeedbackPost feedbackPost) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != feedbackPost.FeedbackPostID) { return BadRequest(); } db.Entry(feedbackPost).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FeedbackPostExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostFeedbackPost(FeedbackPost feedbackPost) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.FeedbackPosts.Add(feedbackPost); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = feedbackPost.FeedbackPostID }, feedbackPost); }