public JsonResult SearchAreaForNewLocationIndoor(string countryUrlPart, string locality) { //-- Step 1) Make a GeoCoding call to Bing var country = AppLookups.Country(countryUrlPart); List<GeocodeResult> results = new GeocodeService().Geocode(country, locality); if (results.Count == 0) { return Json(new { Success = false }); } return Json(new { Success = true, Results = results }); }
public JsonResult SearchAreaForNewArea(string parentAreaID, string countryUrlPart, string locality) { var country = AppLookups.Country(countryUrlPart); Guid parentID; Area parentArea = default(Area); if (Guid.TryParse(parentAreaID, out parentID)) { parentArea = geoSvc.GetAreaByID(parentID); } List<GeocodeResult> results = new List<GeocodeResult>(); if (parentArea == default(Area)) { results = new GeocodeService().Geocode(country, locality); } else { //-- we need to blur the geography otherwise places that are coast to the coast fail... SqlGeography blurredGeo = parentArea.Geo.STBuffer(1500); //-- 1.5Km buffer zone results = new GeocodeService().Geocode(country, locality, blurredGeo); } if (results.Count == 0) { return Json(new { Success = false }); } else { return Json(new { Success = true, Results = results }); } }