// GET: Vehicle
        public ActionResult Index(string selection)
        {
            SelectionViewModel SelectionModel = new SelectionViewModel();

            SelectionModel.Selection   = selection;
            SelectionModel.SwVehicles  = StarWarsApiData.GetSwVehicles();
            SelectionModel.SwStarships = StarWarsApiData.GetSwStarships();

            return(View(SelectionModel));
        }
        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));
        }
        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: 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));
        }