예제 #1
0
        public async Task <IHttpActionResult> PutGuest(int id, Guest guest)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != guest.Guest_No)
            {
                return(BadRequest());
            }

            db.Entry(guest).State = EntityState.Modified;

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #2
0
 public ActionResult EditConfirmed(Guest guest)
 {
     db.Entry(guest).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Guests"));
 }