예제 #1
0
        /// <summary>
        /// Creates the specified customer.
        /// </summary>
        /// <param name="customer">The customer.</param>
        /// <param name="cart">The cart.</param>
        /// <param name="product">The product.</param>
        /// <param name="quantity">The quantity.</param>
        /// <returns>CartProduct.</returns>
        public static CartProduct Create(Customer customer, Cart cart, Product product, int quantity)
        {
            var cartProduct = new CartProduct
            {
                CartId      = cart.Id,
                ProductId   = product.Id,
                Quantity    = quantity,
                CreatedDate = DateTime.Now,
                Cost        = product.Cost,
            };

            return(cartProduct);
        }
예제 #2
0
 /// <summary>
 /// Adds the specified cart product.
 /// </summary>
 /// <param name="cartProduct">The cart product.</param>
 public virtual void Add(CartProduct cartProduct)
 {
     _cartProducts.Add(cartProduct);
 }