コード例 #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();
 }