public double CalculateDiscount(Order order)
        {
            // TODO: order.TotalAmount
            // TODO: discountStrategy.GetDiscount
            double discount = _discountStrategy.GetDiscount(order.TotalAmount);

            return(discount * order.TotalAmount);
        }
 public decimal CalculateDiscount(Order order)
 {
     if (validatorStrategy.CanDiscount(order))
     {
         return discountStrategy.GetDiscount(order);
     }
     else
         return 0;
 }
 public void Calculate(Order order)
 {
     if (ruleStrategy.CanDiscount(order))
     {
         order.DiscountAmount = discountStrategy.GetDiscount(order);
     }
     else
     {
         order.DiscountAmount = 0;
     }
 }
Beispiel #4
0
 public decimal CalculateDiscount(Order order)
 {
     if (discountStrategy.CanDiscount(order))
     {
         return(discountStrategy.GetDiscount(order));
     }
     else
     {
         return(0);
     }
 }
Beispiel #5
0
        public void ProcessOrder(Order order)
        {
            var discountAmount = _discountStrategy.GetDiscount(order.OrderTotal);

            Console.WriteLine("Discount for this order is {0}", discountAmount);
        }