private async Task <bool> UpdateCustomerOrderService(OrderingCustomerDto customer, bool newCustomer)
        {
            if (customer == null ||
                !ValidConfigStrings())
            {
                return(false);
            }
            HttpClient httpClient = await _handler.GetClient(customerAuthUrl,
                                                             customerOrderingApi, customerOrdseringScope);

            if (httpClient == null)
            {
                return(false);
            }
            if (newCustomer)
            {
                if ((await httpClient.PostAsJsonAsync <OrderingCustomerDto>(customerUri, customer))
                    .IsSuccessStatusCode)
                {
                    return(true);
                }
            }
            else
            {
                customerUri = customerUri + "/" + customer.CustomerId;
                if ((await httpClient.PutAsJsonAsync <OrderingCustomerDto>(customerUri, customer))
                    .IsSuccessStatusCode)
                {
                    return(true);
                }
            }
            return(false);
        }
 public async Task <bool> NewCustomer(OrderingCustomerDto newCustomer)
 {
     if (newCustomer != null)
     {
         return(await UpdateCustomerOrderService(newCustomer, true));
     }
     return(false);
 }
 public async Task <bool> EditCustomer(OrderingCustomerDto editedCustomer)
 {
     if (editedCustomer != null)
     {
         return(await UpdateCustomerOrderService(editedCustomer, false));
     }
     return(false);
 }
Esempio n. 4
0
 public async Task <bool> NewCustomer(OrderingCustomerDto newCustomer)
 {
     Customer = newCustomer;
     return(Succeeds);
 }
Esempio n. 5
0
 public async Task <bool> EditCustomer(OrderingCustomerDto editedCustomer)
 {
     Customer = editedCustomer;
     return(Succeeds);
 }