Beispiel #1
0
        // POST: api/CRM
        public bool Post([FromBody] Customer customer)
        {
            if (customer.Address != null)
            {
                XDocument      xDoc          = USPS.GetXDoc(customer.Address);
                List <Address> uspsAddresses = USPS.ValidateAddress(xDoc);
                customer.Address = uspsAddresses[0];
            }

            ICrmRepository crmRespository = new CRMRepository();

            return(crmRespository.UpsertCustomer(customer));
        }
Beispiel #2
0
        public void TestInValidAddress()
        {
            Address address = new Address()
            {
                Line1      = "3800 American Lane",
                City       = "Schaumburg",
                State      = "IL",
                PostalCode = "60173",
                Country    = "US"
            };

            XDocument      xDoc          = USPS.GetXDoc(address);
            List <Address> uspsAddresses = USPS.ValidateAddress(xDoc);

            Assert.AreEqual(uspsAddresses.Count, 1);
            Assert.IsFalse(uspsAddresses[0].IsValid);
        }