public BingMaps SearchByLocationRead()
        {
            BingMapsHelper Bing = new BingMapsHelper(ServiceConfiguration["BingMapsKey"].ToString());

            BingResult res = Bing.SearchByLocation(this.Query, 1);

            if (res == null)
            {
                this.ResultStatus  = "Error";
                this.ResultMessage = "Failed to download and deserialize result";
            }

            if (res.resourceSets == null || res.resourceSets.Count() < 1 || res.resourceSets[0].resources == null || res.resourceSets[0].resources.Count() < 1)
            {
                this.ResultStatus  = "OK";
                this.ResultMessage = "No results";
            }

            Resource resource = res.resourceSets[0].resources[0];

            MapBingMaps(this, resource);
            this.EstimatedTotal = res.resourceSets[0].estimatedTotal;
            this.ResultStatus   = "OK";

            return(this);
        }
        public List <BingMaps> SearchByLocationList()
        {
            List <BingMaps> results = new List <BingMaps>();

            int max = 10;

            if (this.MaxResults > 0)
            {
                max = this.MaxResults;
            }

            BingMapsHelper Bing = new BingMapsHelper(ServiceConfiguration["BingMapsKey"].ToString());

            BingResult res = Bing.SearchByLocation(this.Query, max);

            //if (res == null)
            //{
            //    this.ResultStatus = "Error";
            //    this.ResultMessage = "Failed to download and deserialize result";
            //}

            //if (res.resourceSets == null || res.resourceSets.Count() < 1 || res.resourceSets[0].resources.Count() < 1)
            //{
            //    this.ResultStatus = "OK";
            //    this.ResultMessage = "No results";
            //}

            if (res == null || res.resourceSets == null || res.resourceSets.Count() < 1 || res.resourceSets[0].resources == null || res.resourceSets[0].resources.Count() < 1)
            {
                return(results);
            }

            foreach (Resource resource in res.resourceSets[0].resources)
            {
                BingMaps map = new BingMaps();
                MapBingMaps(map, resource);
                map.Query          = this.Query;
                map.MaxResults     = this.MaxResults;
                map.EstimatedTotal = res.resourceSets[0].estimatedTotal;
                map.ResultStatus   = "OK";
                results.Add(map);
            }

            return(results);
        }