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)); }