コード例 #1
0
ファイル: CustomerController.cs プロジェクト: sidiqahmed/GoF
        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);
        }
コード例 #2
0
ファイル: CustomerController.cs プロジェクト: sidiqahmed/GoF
        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);
        }