public IHttpActionResult PutPackage(string id, Package package) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != package.PackageId) { return(BadRequest()); } db.Entry(package).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PackageExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutBooking(string id, Booking booking) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != booking.BookingId) { return(BadRequest()); } db.Entry(booking).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BookingExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutTourist(string id, Tourist tourist) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tourist.TouristId) { return(BadRequest()); } db.Entry(tourist).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TouristExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }