Пример #1
0
        public void StoreCurrencyCount(CurrencyModel currencyModel, int count)
        {
            if (string.IsNullOrWhiteSpace(currencyModel?.Id))
            {
                return;
            }

            var storedCurrency = new StoredCurrency  {
                CurrencyModel = currencyModel, Count = count
            };

            storedCurrencies[currencyModel.Id] = storedCurrency;

            localStorage.SetItem(storageKey, storedCurrencies);
            CurrencyTotal = this.GetCurrencyTotal();
            this.NotifyStateChanged();
        }
Пример #2
0
 public ActionResult ChangeCurrency(string currencyId)
 {
     var referrer = Request.UrlReferrer != null ? Request.UrlReferrer.ToString() : "/";
     using (var repository = RepositoryFactory.GetInstance(Session))
     {
         var selectedCurrency = repository.FindAllCurrencies(currencyId).FirstOrDefault();
         if (selectedCurrency != null)
         {
             var storedCurrency = new StoredCurrency
             {
                 Id = selectedCurrency.ObjectId,
                 Symbol = selectedCurrency.CurrencySymbol
             };
             Response.Cookies.SetCurrencyCookie(storedCurrency);
         }
         return Redirect(referrer);
     }
 }