Esempio n. 1
0
        public async Task <IActionResult> GetHereSuggestions([FromBody] AddressTextVM text)
        {
            if (string.IsNullOrEmpty(text?.Text))
            {
                return(Ok());
            }

            var result = await _hereService.GetSuggestions(text.Text);

            return(Ok(result));
        }
        private async Task <IEnumerable <SuggesionAddress> > GetHereSuggestions(string text)
        {
            var hereSuggestions = await _hereService.GetSuggestions(text + " Тульская область");

            if (hereSuggestions == null)
            {
                return(Enumerable.Empty <SuggesionAddress>());
            }

            return(hereSuggestions.Suggestions.Select(suggestion => new SuggesionAddress
            {
                Address = suggestion.Address.FullAddress,
                HereLocationId = suggestion.LocationId
            }).Distinct(new SuggesionAddressComparer()));
        }
Esempio n. 3
0
        public async Task <IEnumerable <SuggesionAddress> > GetSuggestions([FromBody] AddressText model)
        {
            var suggestions = await Task.WhenAll(_hereService.GetSuggestions(model?.Text), _hereService.GetPlacesSuggestion(model?.Text));

            return(suggestions[0].Concat(suggestions[1]));
        }