Пример #1
0
        public async Task <IActionResult> AddItemToBasket(int basketid, [FromBody] BasketAddItemRequest request)
        {
            await _basketService.AddItemToBasket(basketid, request.ProductId, request.Price, request.Quantity);

            return(Ok(new BasketAddItemResponse()
            {
                Success = true
            }));
        }
Пример #2
0
 /// <summary>
 /// Adds an item to a specific basket.
 /// If the item already exists in the basket, the quantity is increased instead.
 /// </summary>
 /// <param name="basketId">Basket ID</param>
 /// <param name="itemRequest">Object with details for the item to be added
 /// </param>
 /// <returns>Action success response</returns>
 public async Task <BasketAddItemResponse> AddBasketItem(int basketId, BasketAddItemRequest itemRequest)
 {
     return(await new ApiHttpClient(_baseAddress).PostAsJsonAsync <BasketAddItemResponse>(UriHelpers.AddBasketItemUri(basketId), itemRequest));
 }