public async Task <IActionResult> Edit(int id, [Bind("CustomerId,FirstName,LastName,TelNumber,Address")] Customer customer) { if (id != customer.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("BookingId,BookingDate,CustomerId,staff_id")] Booking booking) { if (id != booking.BookingId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(booking); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookingExists(booking.BookingId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "Address", booking.CustomerId); return(View(booking)); }
public async Task <IActionResult> Edit(int id, [Bind("StaffId,FirstName,LastName,Phone")] Staff staff) { if (id != staff.StaffId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(staff); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StaffExists(staff.StaffId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(staff)); }