Example #1
0
        public async Task <IActionResult> UpdateBasket(int basketid, [FromBody] BasketUpdateItemsRequest requestObject)
        {
            Dictionary <string, int> data = requestObject.Items.Select(i => new { product = i.ProductId, qnt = i.Quantity }).ToDictionary(d => d.product.ToString(), d => d.qnt);
            await _basketService.SetQuantities(basketid, data);

            return(Ok(new BasketUpdateResponse()
            {
                Success = true
            }));
        }
Example #2
0
 /// <summary>
 /// Updates the quantity of basket items supplied
 /// </summary>
 /// <param name="basketId">Basket ID</param>
 /// <param name="itemsRequest">Object with details for the items to be updated</param>
 /// <returns>ction success response</returns>
 public async Task <BasketUpdateResponse> UpdateBasketItem(int basketId, BasketUpdateItemsRequest itemsRequest)
 {
     return(await new ApiHttpClient(_baseAddress).PostAsJsonAsync <BasketUpdateResponse>(UriHelpers.UpdateBasketItemUri(basketId), itemsRequest));
 }