예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }