public void ScanItem(string code) { cart.Add(productService.GetProductByProductCode(code)); policy.Apply(cart); if (ItemScanned != null) { ItemScanned(this, new ItemScannedEventHandlerArgs(cart.Total)); } }
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; }