public async Task <IActionResult> Edit(int id, [Bind("ReservationId,Date,Email,Table")] Reservations reservations) { if (id != reservations.ReservationId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(reservations); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ReservationsExists(reservations.ReservationId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Email"] = new SelectList(_context.Customers, "Email", "Email", reservations.Email); return(View(reservations)); }
public async Task <IActionResult> Edit(string id, [Bind("CustomerId,FirstName,LastName,Email,DishName")] Customers customers) { if (id != customers.Email) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomersExists(customers.Email)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DishName"] = new SelectList(_context.Dishes, "DishName", "DishName", customers.DishName); return(View(customers)); }
public async Task <IActionResult> Edit(string id, [Bind("DishId,DishName,DishDetails")] Dishes dishes) { if (id != dishes.DishName) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dishes); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DishesExists(dishes.DishName)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(dishes)); }