Example #1
0
        public async Task <IActionResult> UpdateQuantityOfTheItem(string id, [FromBody] int quantity)
        {
            if (ModelState.IsValid)
            {
                var basket = await _basketService.ChangeQuantityoftheBasketItemAsync(id, quantity, GetCurrentUserId());

                if (basket != null)
                {
                    return(Ok(ViewHelper.MapToBasketViewModel(basket)));
                }

                return(BadRequest());
            }

            return(BadRequest(ModelState));
        }