public async Task <IActionResult> Edit(int id, [Bind("CustomerID,Name,Company")] 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("ScheduleID,Time,Location,BookingID,CustomerID")] Schedule schedule) { if (id != schedule.ScheduleID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(schedule); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScheduleExists(schedule.ScheduleID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BookingID"] = new SelectList(_context.Booking, "BookingID", "BookingID", schedule.BookingID); return(View(schedule)); }
public async Task <IActionResult> Edit(int id, [Bind("BookingID,CustomerID,Schedule,NoContainer")] 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.Customer, "CustomerID", "CustomerID", booking.CustomerID); return(View(booking)); }