public async Task <IActionResult> Edit(int id, [Bind("Id,FlightNumber,From,To,Price,Scheduled")] Flight flight) { if (id != flight.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(flight); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FlightExists(flight.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(flight)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Email,Name,Mobile")] Passenger passenger) { if (id != passenger.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(passenger); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PassengerExists(passenger.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(passenger)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FlightId,PassengerId")] FlightBooking flightBooking) { if (id != flightBooking.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(flightBooking); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FlightBookingExists(flightBooking.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["FlightId"] = new SelectList(_context.Flight, "Id", "FlightNumber", flightBooking.FlightId); ViewData["PassengerId"] = new SelectList(_context.Set <Passenger>(), "Id", "Name", flightBooking.PassengerId); return(View(flightBooking)); }