public string RunStreetLevelValidation(ServiceRequest serviceRequest) { StreetLevelAddressValidator validator = new StreetLevelAddressValidator("7D15274E4E2A07DE", "Honeybump20!", "pennywise79"); SharpShip.Entities.Address myAddress = new SharpShip.Entities.Address() { AddressLine1 = serviceRequest.Address, City = serviceRequest.City, StateProvince = serviceRequest.State, CountryCode = "US", PostalCode = serviceRequest.Zip }; List <SharpShip.Entities.Address> results = new List <SharpShip.Entities.Address>(); var isvalid = validator.Validate(myAddress, ref results); if (isvalid == true && results.Count > 0) { return("true"); } else { return("false"); } }
public ActionResult RunStreetLevelValidation(string street, string city, string state, string zip) { StreetLevelAddressValidator validator = new StreetLevelAddressValidator("7D15274E4E2A07DE", "Honeybump20!", "pennywise79"); SharpShip.Entities.Address myAddress = new SharpShip.Entities.Address() { AddressLine1 = street, City = city, StateProvince = state, CountryCode = "US", PostalCode = zip }; List <SharpShip.Entities.Address> results = new List <SharpShip.Entities.Address>(); var isvalid = validator.Validate(myAddress, ref results); if (isvalid == true && results.Count > 0) { return(Json(new { success = true, street = street, validated = isvalid, results = results }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = true, street = street, validated = false }, JsonRequestBehavior.AllowGet)); } }