Esempio n. 1
0
		private int GetNumInstancesOfOffer(List<Item> basket, Offer offer)
		{
			return (basket.Count(i => i.Name == offer.EligibleItem))/(offer.Quantity);
		}
 private static double CalculateDiscount(IEnumerable<Item> items, Offer offer) =>
     items
         .Where(i => i.Id == offer.ItemId)
         .Aggregate(0.0, (total, item) => item.Quantity + total)
         .CalculateDiscount(offer.DiscountQualificationQuantity, offer.Discount);