示例#1
0
        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);
        }
示例#2
0
        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));
        }