Exemplo n.º 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)));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddProduct([FromBody] BasketProduct basketProduct)
        {
            await basketService.AddProduct(basketProduct);

            var basketQuantity = await basketService.GetBasketQuantity();

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