Exemplo n.º 1
0
 public void ScanItem(string code)
 {
     cart.Add(productService.GetProductByProductCode(code));
     policy.Apply(cart);
     if (ItemScanned != null)
     {
         ItemScanned(this, new ItemScannedEventHandlerArgs(cart.Total));
     }
 }
Exemplo n.º 2
0
        public override void Apply(Cart cart)
        {
            if (policy != null)
            {
                policy.Apply(cart);
            }

            var discount = 0M;

            foreach (var rule in RuleCollection)
            {
                discount += rule.GetDiscount(cart);
            }

            cart.Total = cart.Total - discount;
        }