コード例 #1
0
 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)));
 }