public ActionResult Loan([Bind(Include = "LoanAmount,TermsInMonths,InterestRate")] VehicleLoanDetailViewModel tempModel, int id) { VehicleLoanDetailViewModel vehicleLoanDetailViewModel = new VehicleLoanDetailViewModel(); vehicleLoanDetailViewModel.LoanDetails = LoanPresentation.GetLoanDetails(Convert.ToDecimal(tempModel.LoanAmount), Convert.ToDecimal(tempModel.TermsInMonths), tempModel.InterestRate); vehicleLoanDetailViewModel.LoanAmount = tempModel.LoanAmount; vehicleLoanDetailViewModel.TermsInMonths = tempModel.TermsInMonths; vehicleLoanDetailViewModel.InterestRate = tempModel.InterestRate; vehicleLoanDetailViewModel.swVehicle = StarWarsApiData.GetSwVehicleById(id); return(View(vehicleLoanDetailViewModel)); }
//Get: Vehicle public ActionResult Detail(int?id) { if (id == null) { return(RedirectToAction("Index", "Vehicle")); } VehicleLoanDetailViewModel DetailModel = new VehicleLoanDetailViewModel(); DetailModel.swVehicle = StarWarsApiData.GetSwVehicleById((int)id); if (DetailModel.swVehicle.Name == "error") { return(RedirectToAction("Index", "Starship")); } DetailModel.LoanAmount = (int)DetailModel.swVehicle.CostInCredits; DetailModel.TermsInMonths = 180; DetailModel.InterestRate = 5.0M; return(View(DetailModel)); }