public async Task <IEnumerable <AirportType> > GetDestinations([Parent] AirlineType airline)
 {
     return(await Task.WhenAll(
                (await _dataStore.FetchRoutesByAirlineAsync(airline.Id))
                .Select(route => route.DestinationAirportId)
                .Distinct()
                .Select(async airportId =>
     {
         var airport = await _dataStore.GetAirportByIdAsync(airportId);
         return _mapper.Map <AirportType>(airport);
     })
                ));
 }
Пример #2
0
 public async Task <AirportType?> GetSource([Parent] RouteType route)
 {
     return(_mapper.Map <AirportType>(await _dataStore.GetAirportByIdAsync(route.SourceAirportId)));
 }