Пример #1
0
        public AddProductToCartResult Handle(AddProductToCartRequest request)
        {
            try
            {
                var cart    = _carts.Get(request.CartId);
                var product = _products.Get(request.ProductId);

                cart.AddLineItem(product, request.Quantity, request.Price);

                _carts.Update(cart);

                return(new AddProductToCartResult(Status.Succeeded));
            }
            catch (Exception ex)
            {
                return(new AddProductToCartResult(Status.Failed, exception: ex));
            }
        }