示例#1
0
        private bool QualifiesForOffer(Product item)
        {
            if (item.Offer == null)
            {
                return false;
            }

            return _bag.Count(x => x.Sku == item.Sku && !x.IsBilled) >= item.Offer.Count;
        }
示例#2
0
 private void ApplyOffer(Product product)
 {
     product.TotalPrice = product.Offer.Price;
     var productsInOffering = _bag.Where(x => x.Sku == product.Sku && !x.IsBilled)
         .Take(product.Offer.Count);
     foreach (var p in productsInOffering)
     {
         p.IsBilled = true;
     }
 }
示例#3
0
 public void Scan(string sku)
 {
     var product = _prices.Single(x => x.Sku == sku);
     var item = new Product
     {
         Sku = product.Sku,
         Price = product.Price,
         Offer = product.Offer
     };
     _bag.Add(item);
 }