public bool Delete(Customer customer)
 {
     IDictionary<string, object> vars = new Dictionary<string, object>(2);
     vars.Add("companyId", this.companyId);
     vars.Add("customerID", customer.Id.Value);
     Customer response = this.restTemplate.PostForObjectAsync<Customer>("/resource/customer/v2/{companyId}/{customerID}?methodx=delete", buildDelete(customer), vars).Result;
     return (response.Id == null);
 }
 public Task<Customer> Save(Customer customer)
 {
     if (customer.Id != null && customer.Id.Value != null)
     {
         return Update(customer);
     }
     else
     {
         return Create(customer);
     }
 }
        public CustomerBuilder()
        {
            _customer = new Customer();

            _customer.TypeOf = partyType.Person;
            _customer.Name = "John Doe";
            _customer.FamilyName = "Doe";
            _customer.GivenName = "John";
            _customer.MiddleName = "J";

            WebSiteAddress webSiteAddress = new WebSiteAddress();
            webSiteAddress.URI = "http://www.digitalinsight.mint.com/";
            List<WebSiteAddress> websites = new List<WebSiteAddress>();
            websites.Add(webSiteAddress);
            _customer.WebSite = websites.ToArray();

            _customer.DBAName = "Mint";
            IdType salesTermId = new IdType();
            salesTermId.Value = "5";
            _customer.SalesTermId = salesTermId;

            EmailAddress emailAddress = new EmailAddress();
            emailAddress.Address = "*****@*****.**";
            List<EmailAddress> emails = new List<EmailAddress>();
            emails.Add(emailAddress);
            _customer.Email = emails.ToArray();

            PhysicalAddress address = new PhysicalAddress();
            address.Line1 = "Park Avenue";
            address.City = "Woodland Hills";
            address.CountrySubDivisionCode = "CA";
            address.PostalCode = "91367";
            List<PhysicalAddress> addresses = new List<PhysicalAddress>();
            addresses.Add(address);
            _customer.Address = addresses.ToArray();
        }
 private Customer buildDelete(Customer customer)
 {
     Customer delete = new Customer();
     delete.SyncToken = customer.SyncToken;
     delete.Id = customer.Id;
     return delete;
 }
 public Task<Customer> Update(Customer customer)
 {
     IDictionary<string, object> vars = new Dictionary<string, object>(2);
     vars.Add("companyId", this.companyId);
     vars.Add("customerID", customer.Id.Value);
     return this.restTemplate.PostForObjectAsync<Customer>("/resource/customer/v2/{companyId}/{customerID}", customer, vars);
 }