Esempio n. 1
0
        public async Task <string> RenderAsync(string model)
        {
            using (ExchangeRateDataProvider dp = new ExchangeRateDataProvider()) {
                ExchangeRateData data = await dp.GetItemAsync();

                List <SelectionItem <string> > list = (from r in data.Rates orderby r.CurrencyName select new SelectionItem <string> {
                    Text = r.CurrencyName, Value = r.Code
                }).ToList();
                return(await DropDownListComponent.RenderDropDownListAsync(this, model, list, "yt_yetawf_currencyconverter_country"));
            }
        }
Esempio n. 2
0
        public async Task <string> RenderAsync(string model)
        {
            using (ExchangeRateDataProvider dp = new ExchangeRateDataProvider()) {
                ExchangeRateData data = await dp.GetItemAsync();

                string currency = (from r in data.Rates where r.Code == model select r.CurrencyName).FirstOrDefault();
                if (string.IsNullOrEmpty(model))
                {
                    return(null);
                }
                return(HE(currency));
            }
        }
Esempio n. 3
0
        public async Task <ActionResult> CurrencyConverter(decimal?amount)
        {
            decimal specificAmount = (amount == null) ? Module.DefaultAmount : (decimal)amount;

            using (ExchangeRateDataProvider dp = new ExchangeRateDataProvider()) {
                ExchangeRateData data = await dp.GetItemAsync();

                Model model = new Model()
                {
                    Rates       = data.Rates,
                    FromCountry = Module.FromCountry,
                    ToCountry   = Module.ToCountry,
                    Amount      = specificAmount,
                };
                return(View(model));
            }
        }