public void CalculateLocation(ZipcodeViewModel zipcodeVM) { Zipcode z = FindZipcodeFromZip(zipcodeVM.Zipcode); Zipcode hq = FindHQZipcode(); zipcodeVM.City = z.City; zipcodeVM.State = z.State; zipcodeVM.Distance = Haversine(z.Latitude, hq.Latitude, z.Longitude, hq.Longitude); }
public ActionResult Index(ZipcodeViewModel zipcodeVM) { if (ModelState.IsValid) { if (_repo.ZipcodeExists(zipcodeVM.Zipcode)) { _repo.CalculateLocation(zipcodeVM); return(RedirectToAction(nameof(HomeController.Calculated), "Home", zipcodeVM)); } else { ViewBag.Message = "Zipcode does not found in database."; } } return(View(zipcodeVM)); }
public ActionResult Calculated(ZipcodeViewModel zipcodeVM) { return(View(zipcodeVM)); }