public void Exercise_13_1_Get_Customers()
        {
            //Create a Customer Account resource
            var customerAccountResource = new Mozu.Api.Resources.Commerce.Customer.CustomerAccountResource(_apiContext);

            //Retrieve an Account by id
            var account = customerAccountResource.GetAccountAsync(1001).Result;

            //Write the Account email
            System.Diagnostics.Debug.WriteLine("Account Email[{0}]: {1}", account.Id, account.EmailAddress);

            //You can also filter the Accounts Get call by email
            var accountByEmail = customerAccountResource.GetAccountsAsync(filter: "EmailAddress eq '*****@*****.**'").Result;

            //write account email
            System.Diagnostics.Debug.WriteLine("Account Email[{0}]: {1}", account.EmailAddress, account.Id);

            //Now, create a Customer Contact resource
            var customerContactResource   = new Mozu.Api.Resources.Commerce.Customer.Accounts.CustomerContactResource(_apiContext);
            var customerContactCollection = new Mozu.Api.Contracts.Customer.CustomerContactCollection();

            if (accountByEmail.TotalCount > 0)
            {
                customerContactCollection = customerContactResource.GetAccountContactsAsync(accountByEmail.Items[0].Id).Result;
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("No contact information -- Customer does not exist");
            }

            if (customerContactCollection.TotalCount > 0)
            {
                foreach (var contact in customerContactCollection.Items)
                {
                    System.Diagnostics.Debug.WriteLine("Name:");
                    System.Diagnostics.Debug.WriteLine(contact.FirstName);
                    System.Diagnostics.Debug.WriteLine(contact.MiddleNameOrInitial);
                    System.Diagnostics.Debug.WriteLine(contact.LastNameOrSurname);
                    System.Diagnostics.Debug.WriteLine("Address:");
                    System.Diagnostics.Debug.WriteLine(contact.Address.Address1);
                    System.Diagnostics.Debug.WriteLine(contact.Address.Address2);
                    System.Diagnostics.Debug.WriteLine(contact.Address.Address3);
                    System.Diagnostics.Debug.WriteLine(contact.Address.Address4);
                    System.Diagnostics.Debug.WriteLine(contact.Address.CityOrTown);
                    System.Diagnostics.Debug.WriteLine(contact.Address.StateOrProvince);
                    System.Diagnostics.Debug.WriteLine(contact.Address.PostalOrZipCode);
                    System.Diagnostics.Debug.WriteLine(contact.Address.CountryCode);
                    System.Diagnostics.Debug.WriteLine(String.Format("Is a validated address? {0}", contact.Address.IsValidated));
                }
            }

            //Create a Customer Credit resource
            var creditResource = new Mozu.Api.Resources.Commerce.Customer.CreditResource(_apiContext);

            //Get credits by customer account id
            var customerCredits = creditResource.GetCreditsAsync(filter: "CustomerId eq '1001'").Result;

            foreach (var customerCredit in customerCredits.Items)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Customer Credit[{0}]: Code({1})Balance ({2})", customerCredit.CustomerId, customerCredit.Code, customerCredit.CurrentBalance));
            }
        }
        public void Exercise_13_1_Get_Customers()
        {
            //Create a Customer Account resource
            var customerAccountResource = new Mozu.Api.Resources.Commerce.Customer.CustomerAccountResource(_apiContext);

            //Retrieve an Account by id
            var account = customerAccountResource.GetAccountAsync(1001).Result;

            //Write the Account email
            System.Diagnostics.Debug.WriteLine("Account Email[{0}]: {1}", account.Id, account.EmailAddress);

            //You can also filter the Accounts Get call by email
            var accountByEmail = customerAccountResource.GetAccountsAsync(filter: "EmailAddress eq '*****@*****.**'").Result;

            //write account email
            System.Diagnostics.Debug.WriteLine("Account Email[{0}]: {1}", account.EmailAddress, account.Id);

            //Now, create a Customer Contact resource
            var customerContactResource = new Mozu.Api.Resources.Commerce.Customer.Accounts.CustomerContactResource(_apiContext);
            var customerContactCollection = new Mozu.Api.Contracts.Customer.CustomerContactCollection();
            if (accountByEmail.TotalCount > 0)
            {
                customerContactCollection = customerContactResource.GetAccountContactsAsync(accountByEmail.Items[0].Id).Result;
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("No contact information -- Customer does not exist");
            }

            if (customerContactCollection.TotalCount > 0)
            {
                foreach (var contact in customerContactCollection.Items)
                {
                    System.Diagnostics.Debug.WriteLine("Name:");
                    System.Diagnostics.Debug.WriteLine(contact.FirstName);
                    System.Diagnostics.Debug.WriteLine(contact.MiddleNameOrInitial);
                    System.Diagnostics.Debug.WriteLine(contact.LastNameOrSurname);
                    System.Diagnostics.Debug.WriteLine("Address:");
                    System.Diagnostics.Debug.WriteLine(contact.Address.Address1);
                    System.Diagnostics.Debug.WriteLine(contact.Address.Address2);
                    System.Diagnostics.Debug.WriteLine(contact.Address.Address3);
                    System.Diagnostics.Debug.WriteLine(contact.Address.Address4);
                    System.Diagnostics.Debug.WriteLine(contact.Address.CityOrTown);
                    System.Diagnostics.Debug.WriteLine(contact.Address.StateOrProvince);
                    System.Diagnostics.Debug.WriteLine(contact.Address.PostalOrZipCode);
                    System.Diagnostics.Debug.WriteLine(contact.Address.CountryCode);
                    System.Diagnostics.Debug.WriteLine(String.Format("Is a validated address? {0}", contact.Address.IsValidated));
                }
            }

            //Create a Customer Credit resource
            var creditResource = new Mozu.Api.Resources.Commerce.Customer.CreditResource(_apiContext);

            //Get credits by customer account id
            var customerCredits = creditResource.GetCreditsAsync(filter: "CustomerId eq '1001'").Result;

            foreach (var customerCredit in customerCredits.Items)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Customer Credit[{0}]: Code({1})Balance ({2})", customerCredit.CustomerId, customerCredit.Code, customerCredit.CurrentBalance));
            }
        }