public IActionResult CreatePassenger(string id) { Passenger_Flight_Crew_Schedule_Model model = new Passenger_Flight_Crew_Schedule_Model(); List <Aircraft> aircraft = new List <Aircraft>(); aircraft = (from Aircraft in _context.Aircraft select Aircraft).Where(a => a.Type == "Passenger" && a.Status == "Available").ToList(); model.Aircraft_list = aircraft; List <Crew> cabin_crew = new List <Crew>(); cabin_crew = (from Crew in _context.Crew select Crew).Where(c => c.Type == "Cabin" && c.Status == "Available").ToList(); List <Crew> flight_crew = new List <Crew>(); flight_crew = (from Crew in _context.Crew select Crew).Where(c => c.Type == "Flight" && c.Status == "Available").ToList(); model.CabinCrewId_list = cabin_crew; model.CabinCrewId2_list = cabin_crew; model.FlightCrewId1_list = flight_crew; model.FlightCrewId2_list = flight_crew; model.CabinCrewId3_list = cabin_crew; model.FlightId = Int32.Parse(id); return(View(model)); }
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)); }