public PartialViewResult CurrencyConvertorTool(CurrencyToolViewModel model) { model.OutputAmount = _currencyService.Convert(model.InputAmount, model.CurrencyTypeFrom, model.CurrencyTypeTo); var rates = _currencyService.GetCurrencyConversions().Where(c => c.CurrencyTypeTo != c.CurrencyTypeFrom); model.CurrencyTypesList = new SelectList(rates, "CurrencyTypeTo", "CurrencyTypeTo"); return(PartialView("_CurrencyConvertorTool", model)); }
public PartialViewResult CurrencyConvertorTool() { var currencyToolViewModel = new CurrencyToolViewModel(); var rates = _currencyService.GetCurrencyConversions().Where(c => c.CurrencyTypeTo != c.CurrencyTypeFrom); currencyToolViewModel.CurrencyTypesList = new SelectList(rates, "CurrencyTypeTo", "CurrencyTypeTo"); return(PartialView("_CurrencyConvertorTool", currencyToolViewModel)); }
public PartialViewResult CalculateAmount(CurrencyToolViewModel model) { if (model.CurrencyTypeFrom == model.CurrencyTypeTo) { return(PartialView("_CalculationResult", 0)); } var calculationResult = _currencyService.Convert(model.InputAmount, model.CurrencyTypeFrom, model.CurrencyTypeTo); return(PartialView("_CalculationResult", calculationResult)); }