public async Task <ActionResult> Search(string address) { var houseSummeries = await repairSearcher.Search(address); var extract = addressExtractor.Extract(houseSummeries.FirstOrDefault()?.Title ?? address); var geoCoordinate = await geocoder.Get(extract.City, extract.Street, extract.House); return(Json(geoCoordinate, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> Get(string latitude, string longitude) { var address = await geocoder.Get(latitude, longitude); if (address == null) { return(new HttpNotFoundResult()); } var searchQuery = $"{address.State} {address.City} {address.Street} {address.House}"; var houseSummeries = await repairSearcher.Search(searchQuery); if (houseSummeries.Length == 0) { return(Json(new { address }, JsonRequestBehavior.AllowGet)); } var repairData = await dataExtractor.Extract(houseSummeries.First()); return(Json(new { address, repair = repairData }, JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> Get(string latitude, string longitude) { var address = await geocoder.Get(new GeoCoordinate { Latitude = latitude, Longitude = longitude }); return(Json(address, JsonRequestBehavior.AllowGet)); }