Beispiel #1
0
        public async Task <IList <Venue> > GetVenuesByGPSCoordinatesAsync(LocatiionCoordinates locatiionCoordinates)
        {
            var requestUri = $"{uri}/venues/search?client_id={clientId}&client_secret={clientSecret}&v={version}&ll={locatiionCoordinates.Latitude},{locatiionCoordinates.Longitude}&limit={limit}&categoryId={categoryId}";

            try
            {
                using (var httpResponse = await _httpClient.GetAsync(requestUri).ConfigureAwait(false))
                {
                    var contentString = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

                    var json   = JsonConvert.DeserializeObject <FoursquareVenueResponse>(contentString);
                    var venues = json.response.venues;
                    if (venues != null)
                    {
                        await _dataService.SaveVenuesAsync(venues).ConfigureAwait(false);
                    }
                    return(venues);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        public async Task <IActionResult> VenuesByGPSCoordinatesAsync([FromBody] LocatiionCoordinates locatiionCoordinates)
        {
            var result = await _locationService.GetVenuesByGPSCoordinatesAsync(locatiionCoordinates).ConfigureAwait(false);

            return(Ok(result));
        }