예제 #1
0
        public ActionResult Edit(long Id)
        {
            DiscountDTO discountDto = _discountService.GetDiscount(Id, CurrentLanguage, CurrentCurrency);

            Mapper.Initialize(c => c.CreateMap <DiscountDTO, DiscountVM>());
            DiscountVM discountVM = Mapper.Map <DiscountDTO, DiscountVM>(discountDto);

            return(View(discountVM));
        }
예제 #2
0
 public virtual decimal GetDiscount(Order order)
 {
     if (discount != null)
     {
         return(discount.GetDiscount(order));
     }
     else
     {
         return(0);
     }
 }
예제 #3
0
        static void NewMain(string[] args, ICalculator calculator, IParts parts, IService service, IDiscount discount)
        {
            var p = parts.GetParts(Decimal.Parse(args[0]));

            var s = service.GetService(Decimal.Parse(args[1]));

            var d = discount.GetDiscount(Decimal.Parse(args[2]));

            var total = calculator.GetTotal(p, s, d);

            Console.WriteLine("Total testy Price: $" + total);
        }
예제 #4
0
        public decimal ValueProducts(IEnumerable <Product> products)
        {
            decimal sumOfProduct = 0;

            foreach (var product in products)
            {
                sumOfProduct += product.Price;
            }

            sumOfProduct *= rate.GetRatio();
            sumOfProduct -= sumOfProduct * (discount.GetDiscount() / 100M);
            return(sumOfProduct);
        }
예제 #5
0
파일: Book.cs 프로젝트: Oblivalny/OOP
 public bool ApplyDiscount(IDiscount applyDiscount)
 {
     if (applyDiscount is IDeliveryDiscount)
     {
         return(false);
     }
     if (!_discounts.Contains(applyDiscount))
     {
         var currentDiscount = applyDiscount.GetDiscount(this);
         if (currentDiscount > 0)
         {
             _discounts.Add(applyDiscount);
             Discount += currentDiscount;
             if (Discount > Price)
             {
                 Discount = Price;
             }
             return(true);
         }
     }
     return(false);
 }
예제 #6
0
 public void ApplyDiscount(IDiscount discount)
 {
     BillDiscount = TotalAmount * discount.GetDiscount();
 }
예제 #7
0
        public decimal GetPrice()
        {
            var multiplier = 1 - _discount.GetDiscount() / 100m;

            return(multiplier * GetFullPrice());
        }
예제 #8
0
 public decimal CalculateDiscount(Order order)
 {
     return(discount.GetDiscount(order));
 }
예제 #9
0
 public decimal CalculatePrice(decimal price)
 {
     return(_decorator.CalculatePrice(_discount.GetDiscount(price)));
 }
예제 #10
0
 public void ApplyDiscount(IDiscount discount)
 {
     Discount = Price * discount.GetDiscount();
 }