public async Task <IActionResult> Search([FromQuery] SearchForPropertiesRequest request) { _logger.LogInformation($"Calling SearchForProperties with query parameters [searchText:{request.SearchText}] [pageSize:{request.PageSize}] [pageNumber:{request.PageNumber}] [assetTypes:{request.AssetTypes}]"); var searchModel = new SearchForPropertiesModel { SearchText = request.SearchText, PageNumber = request.PageNumber, PageSize = request.PageSize, AssetTypes = request.AssetTypes }; var response = await _housingSearchUseCase.ExecuteAsync(searchModel); return(Ok(response)); }
public async Task <SearchForPropertiesResponse> Search(SearchForPropertiesModel searchModel) { _logger.LogInformation($"Calling HousingSearchAPI"); Uri url = new Uri($"search/assets?{searchModel.GetQueryParameters()}", UriKind.Relative); var response = await _apiGateway.ExecuteRequest <HousingSearchAPIResponse>(HttpClientNames.HousingSearch, url); if (!response.IsSuccess) { _logger.LogError($"Call to {url} failed with {response.Status}"); throw new ApiException(response.Status, Resources.PropertiesFailure); } _logger.LogInformation($"Call to HousingSearchAPI was successful with [{response?.Content?.Results?.Assets?.Count}] properties returned and [{response?.Content?.Total}] total results"); return(response.Content.ToResponse()); }