Пример #1
0
        public async Task <resultListCM> getCustomers()
        {
            string url = "https://szgwdsfnutmhvnz.weclapp.com/webapp/api/v1/customer?customerNumber-notnoll&properties=id,company,customerNumber&pageSize=1000";

            using (HttpResponseMessage response = await ApiHelper.ApiClient.GetAsync(url))
            {
                if (response.IsSuccessStatusCode)
                {
                    string customers = await response.Content.ReadAsStringAsync();

                    resultListCM result = JsonConvert.DeserializeObject <resultListCM>(customers);
                    return(result);
                }
                else
                {
                    throw new Exception(response.ReasonPhrase);
                }
            }
        }
Пример #2
0
        private async Task <List <CustomerModel> > LoadCustomer(int customerid = 0)
        {
            ApiProcessor apiProcessor = new ApiProcessor();
            resultListCM customerList = await apiProcessor.getCustomers();

            //resultListCP customPricesList = await apiProcessor.getCustomersWithCustomPricesList();

            foreach (CustomerModel cm in customerList.result)
            {
                resultListCP prices = await apiProcessor.getCustomPricesForCustomer(cm.id);

                if (prices.result.Count > 0)
                {
                    cm.lCustomerPrices = prices.result;
                }
            }

            customerList.result.RemoveAll(item => item.lCustomerPrices == null);

            return(customerList.result);
        }