Ejemplo n.º 1
0
        /// <summary>
        /// 购物车中添加商品
        /// </summary>
        /// <param name="product"></param>
        /// <param name="numBer"></param>
        /// <param name="shoppingCareId"></param>
        /// <returns></returns>
        public ShoppingCart AddProductShoppingCart(Product product, int numBer, Guid shoppingCareId)
        {
            var shoppingCartDetail = new ShoppingCartDetails().CreateCartDetails(product, numBer, shoppingCareId);

            this.ShoppingCartDetailList.Add(shoppingCartDetail);
            return(this);
        }
Ejemplo n.º 2
0
        public ShoppingCart(Guid customerId, Product product, int numBer)
        {
            this.Id         = Guid.NewGuid();
            this.Code       = "购物车";
            this.CustomerId = customerId;
            var cartDetail = new ShoppingCartDetails().CreateCartDetails(product, numBer, this.Id);

            this.ShoppingCartDetailList = new List <ShoppingCartDetails>();
            this.ShoppingCartDetailList.Add(cartDetail);
            double totlePrice = 0;

            foreach (var shoppingCart in ShoppingCartDetailList)
            {
                totlePrice += shoppingCart.CartDetailPrice;
            }
            this.CartTotalPrice = totlePrice;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 移除购物车中的商品
 /// </summary>
 /// <returns></returns>
 public void RemoveShoppingCart(ShoppingCartDetails shoppingCartDetail)
 {
     this.ShoppingCartDetailList.Remove(shoppingCartDetail);
 }