public bool UpdateBookingStatus(int bookingId, string status) { bool updated = false; HM_Booking booking = HMEntities.HM_Booking.Where(x => x.BookingId == bookingId).FirstOrDefault(); booking.Status = status; HMEntities.Entry(booking).State = EntityState.Modified; if (HMEntities.SaveChanges() > 0) { updated = true; } return(updated); }
public IHttpActionResult PutProduct(int id, Product product) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != product.productId) { return(BadRequest()); } db.Entry(product).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }