public async Task <IEnumerable <AirlineType> > GetAirlines(int?offset, int?limit) { return((await _dataStore.FetchAllAirlinesAsync()) .Skip(offset ?? 0) .Take(Math.Min(limit ?? 10, 100)) .Select(_mapper.Map <AirlineType>)); }
public async Task <IEnumerable <AirlineType> > GetAirlines(int?offset, int?limit, string?country) { var expression = new Func <Airline, bool>(x => (string.IsNullOrEmpty(country) ? true : x.Country == country)); return((await _dataStore.FetchAllAirlinesAsync()) .Skip(offset ?? 0) .Where(expression) .Take(Math.Min(limit ?? 10, 100)) .Select(_mapper.Map <AirlineType>)); }