Example #1
0
        public async Task <SearchResponse> SearchAsync(SearchRequest request, SearchResponse response)
        {
            try
            {
                var placesAutoComplete = await _weatherRepository.AutoCompleteAsync(request.SearchParam).ConfigureAwait(false);

                if (placesAutoComplete?.Count > 0)
                {
                    response.Places = new List <PlaceData>();
                    foreach (var place in placesAutoComplete)
                    {
                        response.Places.Add(new PlaceData
                        {
                            CityKey   = place.Key,
                            PlaceName = place.LocalizedName
                        });
                    }
                    response.Success("SearchAsync");
                }
            }
            catch (Exception ex) { response.Failed(ex); }
            return(response);
        }