Example #1
0
        public async Task <int> Add(ProductModel product)
        {
            var userId   = User.GetId();
            var basketId = new BasketId(userId);

            return(await _basket.AddProduct(basketId, new BasketProduct(product.Id, product.Title, product.Price)));
        }
Example #2
0
        public async Task <IActionResult> AddProduct([FromBody] BasketProduct basketProduct)
        {
            await basketService.AddProduct(basketProduct);

            var basketQuantity = await basketService.GetBasketQuantity();

            return(Json(new { basketQuantity }));
        }
Example #3
0
 public void Post([FromBody] Product product)
 {
     _basketService.AddProduct(product);
 }