Exemple #1
0
        public async Task AddProductAsync(Guid userId, Guid productId)
        {
            var product = await _productRepository.GetAsync(productId);

            if (product == null)
            {
                throw new Exception($"Product with id: {productId} was not found.");
            }
            var cart = _cartProvider.Get(userId);

            cart.AddProduct(product);
            _cartProvider.Update(userId, cart);
        }