Esempio n. 1
0
        public async Task <City> GetCityByCityName(string cityName)
        {
            UriBuilder builder = new UriBuilder(_runtimeContext.LocationBaseEndpoint)
            {
                Path  = "REST/v1/Locations",
                Query = $"locality={Uri.EscapeDataString(cityName)}&key={_runtimeContext.BingMapKey}"
            };

            LocationDTO locationResponse = await _requestService.GetAsync <LocationDTO>(builder.Uri);

            LocationMapper locationMapper = new LocationMapper();
            City           city           = locationMapper.ToDomainEntities(locationResponse);

            return(city);
        }