Example #1
0
        // GET: Flight_Aircraft_Crew_Schedule/Create
        public IActionResult CreateCargo(string id)
        {
            Cargo_Aircraft_Crew_Schedule_Model model = new Cargo_Aircraft_Crew_Schedule_Model();

            List <Aircraft> aircraft = new List <Aircraft>();

            aircraft = (from Aircraft in _context.Aircraft
                        select Aircraft).Where(a => a.Type == "Cargo" && a.Status == "Available").ToList();
            model.Aircraft_list = aircraft;

            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.FlightCrewId_list = flight_crew;

            model.FlightCrewId2_list = flight_crew;

            model.FlightCrewId3_list = flight_crew;


            model.FlightId = Int32.Parse(id);

            return(View(model));
        }
Example #2
0
        public async Task <IActionResult> InsertCargoSchedule([Bind("FlightId,AircraftId,FlightCrewId,FlightCrewId2,FlightCrewId3,Flying_Hours")] Cargo_Aircraft_Crew_Schedule_Model schedule)
        {
            if (ModelState.IsValid)
            {
                Cargo_Aircraft_Crew_Schedule m = new Cargo_Aircraft_Crew_Schedule();
                m.FlightId      = schedule.FlightId;
                m.AircraftId    = schedule.AircraftId;
                m.FlightCrewId  = schedule.FlightCrewId;
                m.FlightCrewId2 = schedule.FlightCrewId2;
                m.FlightCrewId3 = schedule.FlightCrewId3;


                _context.Add(m);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", "Home", new { Id = schedule.FlightId.ToString() }));
            }
            return(View(schedule));
        }