Exemple #1
0
        /// <summary>
        /// Adds a variant to the cart.
        /// </summary>
        /// <param name="id">The Id of the variant.</param>
        /// <returns></returns>
        public CartLineItemViewModel Post(string id)
        {
            using (_unitOfWork.BeginTransaction())
            {
                var variant = _variantRepository.Single(v => v.Id == id);
                _currentCart.Cart.AddVariant(variant);

                var updatedCartLineItem = _currentCart.Cart.CartLineItems.Single(line => line.VariantId == id);
                return(_cartViewModelFactory.Create(updatedCartLineItem));
            }
        }