Esempio n. 1
0
        public IActionResult ChangeDefCurrency(ChangeCurrencyViewModel vm)
        {
            if (ModelState.IsValid)
                currencyService.SetDefaultCurrency(vm.SelectedCurrencyCode);

            return RedirectToAction("Index");
        }
Esempio n. 2
0
        public IActionResult ChangeCurrency(string currencyCode)
        {
            var currencies = HttpContext.Session.GetObjectFromJson<List<Currency>>("Currencies");
            var curSelVal = currencies.First(x => x.CurrencyCode.Equals(currencyCode)).CurrencyCode;
            var currencyList = new SelectList(currencies, "CurrencyCode", "CurrencyCode", curSelVal);

            var vm = new ChangeCurrencyViewModel(currencyList);
            return View(vm);
        }
Esempio n. 3
0
        public IActionResult Index(string currencyCode)
        {
            var currencies = HttpContext.Session.GetObjectFromJson<List<Currency>>("Currencies");
            var curSelVal = currencyService.GetDefaultCurrency().CurrencyCode;
            var currencyList = new SelectList(currencies, "CurrencyCode", "CurrencyCode", curSelVal);

            var vm = new ChangeCurrencyViewModel(currencyList);
            return View(vm);
        }
Esempio n. 4
0
 public IActionResult ChangeCurrency(ChangeCurrencyViewModel vm)
 {
     if (ModelState.IsValid)
     {
         HttpContext.Session.SetString("Currency", vm.SelectedCurrencyCode);
         /*currencyService.SetDefaultCurrency(vm.SelectedCurrencyCode)*/
         ;
         return RedirectToAction("Index");
     }
     else
         return View();
 }