コード例 #1
0
ファイル: CartItem.cs プロジェクト: SoulForging/CoolBlue
 public CartItem(SalesDealContainer discountedDeal)
 {
     this.cartDiscountDeal = discountedDeal;
     cartOrderLine = new OrderLine()
     {
         ProductID = cartDiscountDeal.SubProduct.ProductID,
         Quantity = 1,
         Price = Price
     };
 }
コード例 #2
0
 public CartItem(SalesDealContainer discountedDeal)
 {
     this.cartDiscountDeal = discountedDeal;
     cartOrderLine         = new OrderLine()
     {
         ProductID = cartDiscountDeal.SubProduct.ProductID,
         Quantity  = 1,
         Price     = Price
     };
 }
コード例 #3
0
        public void OnAddDiscountedItemToCart(SalesDealContainer itemToAdd)
        {
            var existingBasket = MyCart.FirstOrDefault(s => s.cartDiscountDeal != null && s.cartDiscountDeal.SalesCombination.SalesCombinationID == itemToAdd.SalesCombination.SalesCombinationID);

            if (existingBasket != null)
                existingBasket.AddOne();
            else
                MyCart.Add(new CartItem(itemToAdd));

            CartCount = MyCart.Sum(s => s.cartOrderLine.Quantity);
            CartCost = MyCart.Sum(s => s.cartOrderLine.Price);
        }