Beispiel #1
0
        // GET: Flights
        public async Task <IActionResult> Index()
        {
            var listAirports = await _context.Airport.ToListAsync();

            var listFlights = await _context.Flight.ToListAsync();

            var listFlightPopulated = listFlights.Select(fli => DtoBuilder.populateFlight(fli, listAirports));

            return(View(listFlightPopulated));
        }
Beispiel #2
0
        // GET: Flights/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var flight = await _context.Flight
                         .SingleOrDefaultAsync(m => m.ID.Equals(id));

            if (flight == null)
            {
                return(NotFound());
            }


            var listAirports = await _context.Airport.ToListAsync();

            var flightPopulated = DtoBuilder.populateFlight(flight, listAirports);

            return(View(flightPopulated));
        }