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