private CreditCalcParams GetParamsFromModel(CreditCalculatorParamsVM model) { CreditCalcParams res = new CreditCalcParams(); res.Amount = model.Amount ?? 0; res.Period = model.Period ?? 0; res.Rate = model.Rate ?? 0; res.PromotionPeriod = model.PromotionPeriod; res.PromotionRate = model.PromotionRate; res.GratisPeriod = model.GratisPeriod; res.IsAnnuityInstallments = model.IsAnnuityInstallments; res.ApplicationFee = model.ApplicationFee; res.TreatApplicationFeeAsPercent = model.TreatApplicationFeeAsPercent; res.ProcessingFee = model.ProcessingFee; res.TreatProcessingFeeAsPercent = model.TreatProcessingFeeAsPercent; res.OtherInitialFees = model.OtherInitialFees; res.TreatOtherInitialFeesAsPercent = model.TreatOtherInitialFeesAsPercent; res.MonthlyManagementFee = model.MonthlyManagementFee; res.TreatMonthlyManagementFeeAsPercent = model.TreatMonthlyManagementFeeAsPercent; res.OtherMonthlyFees = model.OtherMonthlyFees; res.TreatOtherMonthlyFeesAsPercent = model.TreatOtherMonthlyFeesAsPercent; res.AnnualManagementFee = model.AnnualManagementFee; res.TreatAnnualManagementFeeAsPercent = model.TreatAnnualManagementFeeAsPercent; res.OtherAnnualFees = model.OtherAnnualFees; res.TreatOtherAnnualFeesAsPercent = model.TreatOtherAnnualFeesAsPercent; return(res); }
public ActionResult FinanceCalculator(CreditCalculatorParamsVM model) { if (!model.IsModelValid(ModelState)) { return(PartialView("_InvalidCreditParamsPartial", model)); } var parameters = GetParamsFromModel(model); CreditCalcResults creditResult = this.calculatorService.CalculateCredit(parameters); CreditCalculatorResultVM creditViewModelResult = GetResultsForModel(creditResult); return(PartialView("_CreditResultsPartial", creditViewModelResult)); }
public ActionResult FinanceCalculator() { CreditCalculatorParamsVM model = new CreditCalculatorParamsVM(); return(View(model)); }