示例#1
0
        async public Task <IActionResult> Index()
        {
            var airportsDto = await airportApiService.GetAll();

            var airportsViewModel = airportsDto.Select(airportDto => new AirportViewModel(airportDto));

            return(View(airportsViewModel));
        }
        async Task PopulateLists(FlightEditViewModel flightEditViewModel)
        {
            var airportsDto = await airportApiService.GetAll();

            var aircraftsDto = await aircraftApiService.GetAll();

            flightEditViewModel.Airports  = new SelectList(airportsDto.OrderBy(a => a.Name), "Id", "Name");
            flightEditViewModel.Aircrafts = new SelectList(aircraftsDto.OrderBy(a => a.Name), "Id", "Name");
        }