public IHttpActionResult PutSeatSelection(string id, SeatSelection seatSelection) { /* if (!ModelState.IsValid) * { * return BadRequest(ModelState); * }*/ if (id != seatSelection.SeatNumber) { return(BadRequest()); } db.Entry(seatSelection).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SeatSelectionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetSeatSelection(string id) { SeatSelection seatSelection = db.SeatSelections.Find(id); if (seatSelection == null) { return(NotFound()); } return(Ok(seatSelection)); }
public IHttpActionResult PostSeatSelection(SeatSelection seatSelection) { /* if (!ModelState.IsValid) * { * return BadRequest(ModelState); * } */ db.SeatSelections.Add(seatSelection); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = seatSelection.SeatNumber }, seatSelection)); }
public IHttpActionResult DeleteSeatSelection(string id) { SeatSelection seatSelection = db.SeatSelections.Find(id); if (seatSelection == null) { return(NotFound()); } db.SeatSelections.Remove(seatSelection); db.SaveChanges(); return(Ok(seatSelection)); }