public int ApplyDiscount(ref IList <Item> itemsLeft) { var itemDiscounted = itemsLeft.Where(item => Skus.Contains(item.Sku)).OrderByDescending(item => item.Price).Take(MatchingQuantity).ToList(); foreach (var item in itemDiscounted) { itemsLeft.Remove(item); } return(itemDiscounted.Sum(item => item.Price) - ForfaitPrice); }
public bool CanApplyTo(IList <Item> itemsLeft) { return(itemsLeft.Count(item => Skus.Contains(item.Sku)) >= MatchingQuantity); }
public bool AppliesTo(char x) { return(Skus.Contains(x)); }