public Cart GetPromotion() { Cart promotionCart = new Cart(); for (int count = 0; count < this.Cart.CartList.Length; count++) { Product promotionProduct = this.Cart.CartList[count]; for (int position = 0; position < ShopInformation.CurrentPromotion.PromotionList.Length; position++) { if (promotionProduct == ShopInformation.CurrentPromotion.PromotionList[count]) { promotionProduct.Price = ShopInformation.CurrentPromotion.PromotionList[count].Price; } } promotionCart.AddProduct(promotionProduct); } return promotionCart; }
public Cart GetPromotion(Cart currentCart) { Cart cart = new Cart(); for (int position = 0; position < currentCart.CartList.Length; position++) { Product currentProduct = currentCart.CartList[position]; for (int count = 0; count < promotionList.Length; count++) { if (currentProduct == promotionList[count]) { currentProduct.Price = promotionList[count].Price; } } cart.AddProduct(currentProduct); } return cart; }