public IActionResult Index() { var viewModel = new ShowCurrencyConverterViewModel(); viewModel.AllCurrencies = GetAllCurrencies(); return(View(viewModel)); }
public IActionResult Index(ShowCurrencyConverterViewModel model) { //if ((model.Tal % 2) == 0) //{ // ModelState.AddModelError("Tal", "MÃ¥ste vara ijmt"); //} if (ModelState.IsValid) { model.Result = _currentCalculator.ConvertCurrency(model.FromCurrency, model.ToCurrency, model.Belopp); } model.AllCurrencies = GetAllCurrencies(); return(View(model)); }