Example #1
0
 /// <summary>
 /// Dispose of resources being used by the disposable object.
 /// </summary>
 /// <param name="disposing">
 /// Explicit disposal?
 /// </param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         PlaceSearch?.Dispose();
     }
 }
        public List<XamarinEvolveSSLibrary.Place> GetNearbyPlaces(float lat, float lng)
        {
            List<XamarinEvolveSSLibrary.Place> ret = new List<XamarinEvolveSSLibrary.Place> ();

            PlaceSearch search = new PlaceSearch {
                lat = lat,
                lng = lng,
                types="bar|cafe|casino|establishment|food|gym|hospital|liquor_store|lodging|movie_theater|night_club|restaurant|stadium|store|zoo",
                sensor="false",
            };

            string uri = string .Format("nearbysearch/json{0}",
                                        search.GetQueryString ());

            PlaceSearchResponse response = null;

            try
            {
                response = _client.Get <PlaceSearchResponse> (uri);
            }
            catch (Exception)
            {

            }

            if (response != null && response.results != null &&
                response.results.Length > 0)
                ret = FillPlaceList (response.results);

            return ret;
        }
Example #3
0
        public PagedResponse <PlaceDto> Execute(PlaceSearch search)
        {
            var query = _context.Places.AsQueryable();

            if (search.LocationID is int)
            {
                query = query.Where(x => x.LocationID == search.LocationID);
            }

            if (search.CityID is int)
            {
                query = query.Where(x => x.CityID == search.CityID);
            }

            return(query.Paged <PlaceDto, Place>(search, _mapper));
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GoogleMapsApiClient"/> class.
        /// </summary>
        /// <param name="apiKey">
        /// The api key.
        /// </param>
        public GoogleMapsApiClient(string apiKey)
        {
            var url = EndPointUris.GetBaseUri();

            var httpClientHandler = new HttpClientHandler();
            var httpClient        = new HttpClientAdapter(
                new HttpClient(httpClientHandler, true)
            {
                BaseAddress = url
            });
            var webApi = new WebApi(httpClient, apiKey);

            PlaceSearch       = new PlaceSearch(webApi);
            GeocodingService  = new GeocodingService(webApi);
            DirectionsService = new DirectionsService(webApi);
        }
 public IActionResult Get([FromQuery] PlaceSearch search, [FromServices] IGetPlacesQuery query)
 {
     return(Ok(_executor.ExecuteQuery(query, search)));
 }