public IActionResult Index(PenaltyInputModel model)
        {
            setDropDownListForCountry();

            if (ModelState.IsValid)
            {
                var _country = _countryRepository.GetCountryById(model.Country.CountryId);
                model.Country = _country;

                var item = _penaltyCalculationProcessor.Process(model);

                if (item != null)
                {
                    ViewBag.BusinessDays   = item.BusinessDays;
                    ViewBag.Penalty        = item.TotalPrice;
                    ViewBag.CurrencySymbol = item.CurrencySymbol;
                    ViewBag.ShowResult     = true;
                }
                return(View(model));
            }
            return(View(model));
        }
Esempio n. 2
0
 public void CanNotBeNullPenaltyInputModelThrowExceptionTest()
 {
     Assert.Throws <Exception>(() => penaltyCalculationProcessor.Process(null));
 }