示例#1
0
        public async Task <IActionResult> PutImage(Guid id, Image image)
        {
            if (id != image.Id)
            {
                return(BadRequest());
            }

            _context.Entry(image).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ImageExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutHairdresser(int id, Hairdresser hairdresser)
        {
            if (id != hairdresser.Id)
            {
                return(BadRequest());
            }

            _context.Entry(hairdresser).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HairdresserExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutBooking(Guid id, Booking booking)
        {
            if (id != booking.Id)
            {
                return(BadRequest());
            }

            if (!(await _bookingValidator.BookingCanBeUpdatedAsync(booking)))
            {
                return(Conflict());
            }

            _context.Entry(booking).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BookingExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutTreatment(int id, Treatment treatment)
        {
            if (id != treatment.Id)
            {
                return(BadRequest());
            }

            _context.Entry(treatment).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TreatmentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#5
0
 public ActionResult Edit(Booking booking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(booking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(booking));
 }
示例#6
0
 public ActionResult Edit([Bind(Include = "ID,RoomNumber,FromDate,ToDate,userId")] Booking booking)
 {
     if (ModelState.IsValid)
     {
         db.Entry(booking).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(booking));
 }
 public void UpdateBooking(Booking booking)
 {
     context.Entry(booking).State = EntityState.Modified;
 }