예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }