Example #1
0
        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));
        }
        public async Task <IActionResult> Create([Bind("FlightId,LeavingDate,DepartureTime,ArrivalDate,ArrivalTime,Origin,Destination")] Flight flight)
        {
            if (ModelState.IsValid)
            {
                _context.Add(flight);
                await _context.SaveChangesAsync();

                // ViewData["flightId"] = flight.FlightId;
                return(RedirectToAction("PlaneChoice", new { Id = flight.FlightId }));
                // return RedirectToAction(nameof(Flight_Aircraft_Crew_ScheduleController.Create));
            }
            return(View());
        }