public decimal WaterDiscTotal(WaterBill waterBill, Tariff tariff)
 {
     decimal totalValue = 0;
     List<decimal> tariffStr = tariff.ParseDiscString(tariff.WaterDiscString);
     if (tariffStr.Count == 5)
     {
         if (waterBill.WaterUsage >= tariffStr[0])
         {
             totalValue += tariffStr[0] * tariffStr[2];
             if (waterBill.WaterUsage < tariffStr[1])
             {
                 totalValue += (waterBill.WaterUsage - tariffStr[0]) * tariffStr[3];
             }
             else
             {
                 totalValue += ((tariffStr[1] - tariffStr[0]) * tariffStr[3]) + ((waterBill.WaterUsage - tariffStr[1]) * tariffStr[4]);
             }
         }
         else
         {
             return waterBill.WaterUsage * tariffStr[2];
         }
         return totalValue;
     }
     return totalValue;
 }
 public ViewResult AddWaterbillToCheckout()
 {
     WaterBill waterBill = new WaterBill();
     return View(waterBill);
 }
        public RedirectToRouteResult AddWaterbillToCheckout(Checkout order, WaterBill waterBill, string returnUrl)
        {
            if (waterBill != null)
            {
                if (order.chosenTariff == null)
                {
                    order.chosenTariff = tariffRepo.Tariffs
                        .FirstOrDefault(p => p.Id != null);

                }

                order.InitCalc(new ValueCalculator());
                order.SetWater(waterBill);
            }
            return RedirectToAction("Index", new { returnUrl });
        }
 public decimal WaterTotal(WaterBill waterBill, Tariff tariff)
 {
     return waterBill.WaterUsage * tariff.WaterTariff;
 }