public async Task <IActionResult> Edit(int id, [Bind("ScheduleId,FlightId,AircraftId,CabinCrewId,CabinCrewId2,CabinCrewId3,FlightCrewId1,FlightCrewId2,FlightCrewId3,Flying_Hours")] Passenger_Aircraft_Crew_Schedule flight_Aircraft_Crew_Schedule) { if (id != flight_Aircraft_Crew_Schedule.ScheduleId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(flight_Aircraft_Crew_Schedule); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Flight_Aircraft_Crew_ScheduleExists(flight_Aircraft_Crew_Schedule.ScheduleId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(flight_Aircraft_Crew_Schedule)); }
public async Task <IActionResult> InsertPassengerSchedule([Bind("FlightId,AircraftId,CabinCrewId,CabinCrewId2,FlightCrewId1,FlightCrewId2,CabinCrewId3,Flying_Hours")] Passenger_Flight_Crew_Schedule_Model schedule) { if (ModelState.IsValid) { Passenger_Aircraft_Crew_Schedule m = new Passenger_Aircraft_Crew_Schedule(); m.FlightId = schedule.FlightId; m.AircraftId = schedule.AircraftId; m.CabinCrewId = schedule.CabinCrewId; m.CabinCrewId2 = schedule.CabinCrewId2; m.FlightCrewId1 = schedule.FlightCrewId1; m.FlightCrewId2 = schedule.FlightCrewId2; m.CabinCrewId3 = schedule.CabinCrewId3; _context.Add(m); await _context.SaveChangesAsync(); // return RedirectToAction("CreateCargo", "Flight_Aircraft_Crew_Schedule", new { id = m.FlightId.ToString()}); return(RedirectToAction("PlaneChoice", "Flight", new { Id = schedule.FlightId.ToString() })); // return RedirectToAction(nameof(PlaneChoice)); } return(View(schedule)); }