public async Task <bool> DeleteCustomer(int customerId)
        {
            if (!ValidConfigStrings())
            {
                return(false);
            }
            HttpClient httpClient = await _handler.GetClient(customerAuthUrl, customerReviewApi, customerReviewScope);

            if (httpClient == null)
            {
                return(false);
            }
            reviewUri = reviewUri + customerId;
            if ((await httpClient.DeleteAsync(reviewUri)).IsSuccessStatusCode)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public async Task <bool> DeleteAccount(string customerAuthId)
        {
            HttpClient httpClient = await _handler.GetClient("CustomerAuthServerUrl", "CustomerAuthAPI", "CustomerAuthCustomerScope");

            string uri = _config.GetSection("AuthUri").Value + "/" + customerAuthId;

            if ((await httpClient.DeleteAsync(uri)).IsSuccessStatusCode)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        public async Task <bool> NewOrder(OrderInvoiceDto order)
        {
            if (order == null || order.OrderedItems.Count == 0 || !ValidConfigStrings())
            {
                return(false);
            }
            HttpClient httpClient = await _handler.GetClient(staffAuthUrl, invoiceApi, invoiceScope);

            if (httpClient != null)
            {
                if ((await httpClient.PostAsJsonAsync <OrderInvoiceDto>(invoiceUri, order)).IsSuccessStatusCode)
                {
                    return(true);
                }
            }
            return(false);
        }
        public async Task <bool> NewPurchases(PurchaseDto purchases)
        {
            if (purchases == null || purchases.OrderedItems.Count == 0 || !ValidConfigStrings())
            {
                return(false);
            }
            HttpClient httpClient = await _handler.GetClient(customerAuthUrl, reviewApi, reviewScope);

            if (httpClient != null)
            {
                if ((await httpClient.PostAsJsonAsync <PurchaseDto>(reviewUri, purchases)).IsSuccessStatusCode)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 5
0
        public async Task <bool> UpdateStock(List <StockReductionDto> stockReductions)
        {
            if (stockReductions == null || stockReductions.Count == 0 || !ValidConfigStrings())
            {
                return(false);
            }

            HttpClient httpClient = await _handler.GetClient(staffAuthUrl, staffProductApi, staffProductScope);

            if (httpClient != null)
            {
                if ((await httpClient.PutAsJsonAsync <List <StockReductionDto> >(staffProductUri, stockReductions)).IsSuccessStatusCode)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 6
0
        public async Task <bool> UpdateProducts(IList <ProductUpdateDto> products)
        {
            if (products == null || products.Count == 0 || !ValidConfigStrings())
            {
                return(false);
            }
            HttpClient httpClient = await _handler.GetClient(customerAuthUrl, orderingApi, orderingScope);

            if (httpClient != null)
            {
                var result = await httpClient.PostAsJsonAsync <IList <ProductUpdateDto> >(orderingUri, products);

                if (result.IsSuccessStatusCode)
                {
                    return(true);
                }
            }
            return(false);
        }