public IHttpActionResult PutBooking(int id, Booking booking) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != booking.ID) { 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 Putmovies(int id, visning movies) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != movies.id) { return(BadRequest()); } db.Entry(movies).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!moviesExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }