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