public IHttpActionResult PutBooking(int id, Booking booking) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != booking.BookingId) { return(BadRequest()); } try { bs.UpdateBooking(id, booking); } catch (DbUpdateConcurrencyException) { return(NotFound()); } return(StatusCode(HttpStatusCode.NoContent)); }
public bool PutBooking(int id, Booking booking) { if (ModelState.IsValid) { try { bool isUpdated = bs.UpdateBooking(id, booking); return(isUpdated); } catch (BookingsException) { throw; } } //catch (DbUpdateConcurrencyException) //{ //} else { throw new BookingsException("The entered details to fetch booking are not valid"); } }