Пример #1
0
        /// <summary>
        /// Used to get all supported currencies at Bittrex along with other meta data.
        /// </summary>
        /// <returns>A list of all supported currencies</returns>
        public static List <MarketCurrency> GetCurrencies()
        {
            List <MarketCurrency> MarketCurrencyList = new List <MarketCurrency>();

            dynamic response = JsonConvert.DeserializeObject(HTTPMethods.HttpGet(Constants.baseUrl + "/public/getcurrencies"));

            if (response.success == false)
            {
                throw new Exception("Unable to get data from API: " + response.message.ToString());
            }

            foreach (var item in response.result)
            {
                MarketCurrency currency = new MarketCurrency(
                    item.Currency.ToString(),
                    item.CurrencyLong.ToString(),
                    item.MinConfirmation.ToString(),
                    Convert.ToDouble(item.TxFee),
                    Convert.ToBoolean(item.IsActive),
                    item.CoinType.ToString(),
                    item.BaseAddress.ToString()
                    );

                MarketCurrencyList.Add(currency);
            }

            return(MarketCurrencyList);
        }
Пример #2
0
        private async Task FullOutModel <TModel, TPage>(TModel viewModel) where TModel : PageViewModel <TPage> where TPage : PageData
        {
            viewModel.CartApiUrl = "/cart";
            viewModel.CartUrl    = "/en/shooping-cart/";

            var currentMarket = _currentMarket.GetCurrentMarket();

            var markets        = _marketService.GetAllMarkets();
            var maketsSelector = new List <SelectEntry>();

            foreach (var market in markets)
            {
                foreach (var currencie in market.Currencies)
                {
                    var code = MarketCurrency.Create(market.MarketId.Value, currencie.CurrencyCode);
                    maketsSelector.Add(new SelectEntry()
                    {
                        DisplayName = $"{market.MarketName} - {currencie.CurrencyCode}", Selected = market.MarketId.Value == currentMarket.MarketId.Value, Key = code.ToString()
                    });
                }
            }

            viewModel.Markets = maketsSelector;

            var bugerMenu = await _mediator.Send(CategoryRequest.Create(_menuSettings.MovieFolder));

            viewModel.Categories = bugerMenu.CategoryEntries.Select(x => new MenuItem()
            {
                Link = x.Link, Title = x.Title
            });
        }
Пример #3
0
        public ActionResult SetMarket(string id, string rtnUrl)
        {
            var code = MarketCurrency.Create(id);

            _currentMarket.SetCurrentMarket(code.MarketId);
            _currentCurrency.SetCurrentCurrency(code.CurrentCode);

            var redirectUrl = !string.IsNullOrEmpty(rtnUrl) ? rtnUrl : "/";

            return(Redirect(redirectUrl));
        }