public async Task <ActionResult> GetAsync( string nameFilter, int?minCarryingKg, int?maxCarryingKg, int?minSeatCount, int?maxSeatCount, int?currentPage, int?pageLimit ) { currentPage ??= _paginationSettings.DefaultPage; pageLimit ??= _paginationSettings.DefaultPageSize; if (pageLimit > _paginationSettings.MaxPageLimit) { return(BadRequest()); } BlItemsPage airplanesBl; if (!string.IsNullOrEmpty(nameFilter) || minCarryingKg != null || maxCarryingKg != null || minSeatCount != null || maxSeatCount != null ) { AirplaneFilter airplaneFilter = new AirplaneFilter( nameFilter, minCarryingKg, maxCarryingKg, minSeatCount, maxSeatCount, currentPage.Value, pageLimit.Value); BlAirplaneFilter airplaneFilterBl = _mapper.Map <BlAirplaneFilter>(airplaneFilter); airplanesBl = await _airplaneService.SearchAirplanesAsync(airplaneFilterBl); } else { airplanesBl = await _airplaneService.GetAllAsync(currentPage.Value, pageLimit.Value); } ItemsPage <Airplane> airplanes = _mapper.Map <ItemsPage <Airplane> >(airplanesBl); return(Ok(airplanes)); }