public Customer GetCustomer(int customerId) { CustomerRequest request = new CustomerRequest(); request.RequestId = NewRequestId; request.AccessToken = AccessToken; request.ClientTag = ClientTag; request.LoadOptions = new string[] { "Customer" }; request.Criteria = new CustomerCriteria { CustomerId = customerId }; CustomerResponse response = ActionServiceClient.GetCustomers(request); if (request.RequestId != response.CorrelationId) { throw new ApplicationException("GetCustomers: RequestId and CorrelationId do not match."); } return(response.Customer); }
public IList <Customer> GetCustomersWithOrderStatistics(string sortExpression) { CustomerRequest request = new CustomerRequest(); request.RequestId = NewRequestId; request.AccessToken = AccessToken; request.ClientTag = ClientTag; request.LoadOptions = new string[] { "Customers" }; request.Criteria = new CustomerCriteria { SortExpression = sortExpression, IncludeOrderStatistics = true }; CustomerResponse response = ActionServiceClient.GetCustomers(request); if (request.RequestId != response.CorrelationId) { throw new ApplicationException("GetCustomers: RequestId and CorrelationId do not match."); } return(response.Customers); }