Exemplo n.º 1
0
		private int GetNumInstancesOfOffer(List<Item> basket, Offer offer)
		{
			return (basket.Count(i => i.Name == offer.EligibleItem))/(offer.Quantity);
		}
Exemplo n.º 2
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);
Exemplo n.º 4
0
 /// <summary>
 /// Returns items valid for the current offer, which have not had offers applied
 /// </summary>
 private List <Item> GetOfferItems(Offer offer)
 {
     return(Items.FindAll(p => p.SKU == offer.SKU && p.OfferApplied == false));
 }