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)); }
public ActionResult EditConfirmed(Guest guest) { db.Entry(guest).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Guests")); }