Beispiel #1
0
 public CartItem(SalesDealContainer discountedDeal)
 {
     this.cartDiscountDeal = discountedDeal;
     cartOrderLine = new OrderLine()
     {
         ProductID = cartDiscountDeal.SubProduct.ProductID,
         Quantity = 1,
         Price = Price
     };
 }
Beispiel #2
0
 public CartItem(SalesDealContainer discountedDeal)
 {
     this.cartDiscountDeal = discountedDeal;
     cartOrderLine         = new OrderLine()
     {
         ProductID = cartDiscountDeal.SubProduct.ProductID,
         Quantity  = 1,
         Price     = Price
     };
 }
        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);
        }