public IHttpActionResult PutFlightBookSummary(int id, FlightBookSummary flightBookSummary) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != flightBookSummary.bookID) { return(BadRequest()); } db.Entry(flightBookSummary).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FlightBookSummaryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostFlightBookSummary(FlightBookSummary flightBookSummary) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.FlightBookSummaries.Add(flightBookSummary); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = flightBookSummary.bookID }, flightBookSummary)); }
public IHttpActionResult DeleteFlightBookSummary(int id) { FlightBookSummary flightBookSummary = db.FlightBookSummaries.Find(id); if (flightBookSummary == null) { return(NotFound()); } db.FlightBookSummaries.Remove(flightBookSummary); db.SaveChanges(); return(Ok(flightBookSummary)); }