public async Task <IActionResult> Edit(int id, [Bind("BookingId,CustomerId,NoAdults,NoChildren,NoInfants,SailingDate,RouteId")] Bookings bookings) { if (id != bookings.BookingId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bookings); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookingsExists(bookings.BookingId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "EmailAddress", bookings.CustomerId); ViewData["RouteId"] = new SelectList(_context.Routes, "RouteId", "RouteName", bookings.RouteId); return(View(bookings)); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerId,FirstName,LastName,MobileNo,EmailAddress")] Customers customers) { if (id != customers.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomersExists(customers.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customers)); }
public async Task <IActionResult> Edit(int id, [Bind("RouteId,RouteName")] Routes routes) { if (id != routes.RouteId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(routes); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RoutesExists(routes.RouteId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(routes)); }