示例#1
0
文件: Cart.cs 项目: jbalde/yshop
        /// <summary>
        /// Add the specified product.
        /// </summary>
        /// <param name='product'>
        /// Product.
        /// </param>
        public void add(Product product)
        {
            for(int i = 0; i < this.products.Count; i++) {
                if(this.products[i].Id == product.Id) {
                    this.products[i].Amount += product.Amount;
                    return;
                }
            }

            product.fillProduct();
            this.products.Add(product);
        }