public ActionResult Index() { var model = new TariffCalculatorModel() { LocalPeakPercent = 50, NationalPeakPercent = 50, TariffList = tariffCalculator.GetAllTariffs() .Select(tariff => new SelectListItem() { Value = tariff.Id, Text = tariff.Name, Selected = false }) }; return(View(model)); }
// GET: TariffCalculator public ActionResult Index() { var model = new TariffCalculatorModel { LocalPeakPercent = 50, NationalDuration = 50, LocalDuration = 30, NationalPeakPercent = 40, TariffList = tariffCalculator.GetAllTariffs().Select(x => new SelectListItem { Text = x.Name, Value = x.Id }) }; return(View(model)); }
public List <Tariff> GetAllTariffs() { return(new List <Tariff>(TariffCalculator.GetAllTariffs())); }