public IHttpActionResult PutBookedPlace(int id, BookedPlace bookedPlace) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bookedPlace.BookedPlaceId) { return(BadRequest()); } db.Entry(bookedPlace).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BookedPlaceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetBookedPlace(int id) { BookedPlace bookedPlace = db.BookedPlaces.Find(id); if (bookedPlace == null) { return(NotFound()); } return(Ok(bookedPlace)); }
public IHttpActionResult DeleteBookedPlace(int id) { BookedPlace bookedPlace = db.BookedPlaces.Find(id); if (bookedPlace == null) { return(NotFound()); } db.BookedPlaces.Remove(bookedPlace); db.SaveChanges(); return(Ok(bookedPlace)); }