コード例 #1
0
        public IActionResult Walletinfo()
        {
            var coinInfo = mainCoins.GetCoin();

            return(View(new WalletinfoViewModel()
            {
                MainCoinModel = coinInfo
            }));
        }
コード例 #2
0
        public IActionResult Index()
        {
            var mc        = mainCoins.GetCoin();
            var blockHash = mainCoins.GetBlockByIdMongo(559529);
            var block     = mainCoins.GetBlockByHashMongo(blockHash.Hash);

            return(View(new ApiViewModel()
            {
                MainCoinModel = mc,
                BlockHash = blockHash.Hash,
                Tx = block.AssetTX.First()
            }));
        }
コード例 #3
0
        public IActionResult Index(bool?success, bool?error, string address)
        {
            if (success.HasValue & error.HasValue && success.Value && error.Value)
            {
                success = false;
            }
            var cm = new ClaimModel()
            {
                Error         = error,
                Success       = success,
                Address       = address,
                MainCoinModel = mainCoins.GetCoin()
            };

            return(View(cm));
        }
コード例 #4
0
        public IActionResult Index()
        {
            var mc = mainCoins.GetCoin();

            if (!mc.IsCoinDistribution)
            {
                return(View("~/Views/Shared/FeatureDisabled.cshtml"));
            }
            var richList = mainCoins.GetRichList();

            return(View(new RichListViewModel()
            {
                RichList = richList,
                MainCoinModel = mc
            }));
        }
コード例 #5
0
        public IActionResult Index()
        {
            HashrateViewModel hashRate;
            var coins = mainCoins.GetCoin();

            if (!_cache.TryGetValue(coins.CoinSymbol + "_main_index", out hashRate))
            {
                var  lastBlock           = mainCoins.GetLastBlockMongo();
                var  coinconfirm         = lastBlock + coins.CoinConfirms;
                var  lastBlockWalletHash = mainCoins.GetBlockByIdMongo(lastBlock);
                int  showBlocks          = _configuration.GetSection("TotalShow").Get <int>();
                var  lastBlocks          = mainCoins.GetlastXAssetBlocks(showBlocks);
                var  blk      = lastBlocks.FirstOrDefault();
                uint blkAsset = 0;
                if (blk != null)
                {
                    blkAsset = checked ((uint)blk.Height);
                }
                hashRate = new HashrateViewModel
                {
                    ShowBlocks     = showBlocks,
                    LastBlock      = lastBlock,
                    LastAssetBlock = blkAsset,
                    LastBlocks     = lastBlocks,
                    MainCoinModel  = coins
                };
                _cache.Set(coins.CoinSymbol + "_main_index", hashRate, _memoryCacheEntryOptions);
            }
            return(View(hashRate));
        }
コード例 #6
0
        public IActionResult Index()
        {
            var           coinInfo = mainCoins.GetCoin();
            ExchangePrice ep       = exchange.GetMarketprice(coinInfo.CoinSymbol.ToUpper());
            var           trends   = exchange.GetGlobalTrends(coinInfo.CoinSymbol.ToUpper());
            Decimal       trend    = Math.Round(trends[0], 2);
            Decimal       trend7   = Math.Round(trends[1], 2);
            Decimal       trend14  = Math.Round(trends[2], 2);
            Decimal       trend30  = Math.Round(trends[3], 2);
            Decimal       trend60  = Math.Round(trends[4], 2);
            Decimal       trend90  = Math.Round(trends[5], 2);

            /*
             * Decimal trend = Math.Round(exchange.GetGlobalTrend(coinInfo.CoinSymbol.ToUpper(), ep, 1), 2);
             * Decimal trend7 = Math.Round(exchange.GetGlobalTrend(coinInfo.CoinSymbol.ToUpper(), ep, 6), 2);
             * Decimal trend14 = Math.Round(exchange.GetGlobalTrend(coinInfo.CoinSymbol.ToUpper(), ep, 13), 2);
             * Decimal trend30 = Math.Round(exchange.GetGlobalTrend(coinInfo.CoinSymbol.ToUpper(), ep, 29), 2);
             * Decimal trend60 = Math.Round(exchange.GetGlobalTrend(coinInfo.CoinSymbol.ToUpper(), ep, 59), 2);
             * Decimal trend90 = Math.Round(exchange.GetGlobalTrend(coinInfo.CoinSymbol.ToUpper(), ep, 89), 2);
             */
            List <ExchangeHistory> sevenDays = mainCoins.GetHistory(coinInfo.CoinSymbol.ToUpper(), 7);
            ExchangeFiat           fiat      = exchange.GetMarketFiat();
            var em      = mainCoins.GetExchanges();
            var markets = mainCoins.GetExchangePrice(coinInfo.CoinSymbol.ToUpper(), em);

            return(View(new ExchangeIndexViewModel()
            {
                ExchangeHistoy = sevenDays,
                MainCoinModel = coinInfo,
                ExchangePrice = ep,
                Trend = trend,
                Trend7 = trend7,
                Trend14 = trend14,
                Trend30 = trend30,
                Trend60 = trend60,
                Trend90 = trend90,
                ExchangeFiat = fiat,
                Exchanges = em,
                ExchangePriceList = markets
            }));
        }
コード例 #7
0
        public void OnActionExecuting(ActionExecutingContext context)
        {
            var controller = context.Controller as Controller;

            if (controller != null)
            {
                var    rqf       = controller.Request.HttpContext.Features.Get <IRequestCultureFeature>();
                string appendUrl = string.Empty;
                if (rqf.RequestCulture != null)
                {
                    controller.Response.Cookies.Append(
                        CookieRequestCultureProvider.DefaultCookieName,
                        CookieRequestCultureProvider.MakeCookieValue(rqf.RequestCulture),
                        new CookieOptions {
                        Expires = DateTimeOffset.UtcNow.AddYears(1)
                    }
                        );
                    if (rqf.RequestCulture.UICulture.ToString() != "en")
                    {
                        appendUrl = "/" + rqf.RequestCulture.UICulture.ToString();
                    }
                }
                var donationAddr = _mc.GetCoin().DonationAddress;

                controller.ViewBag.Favicon            = _mc.GetCoin().Favicon;
                controller.ViewBag.AppendUrl          = appendUrl;
                controller.ViewBag.CoinName           = _mc.GetCoin().CoinName;
                controller.ViewBag.IsCoinDistribution = _mc.GetCoin().IsCoinDistribution;
                controller.ViewBag.IsExchange         = _mc.GetCoin().IsExchange;
                controller.ViewBag.DonationAddress    = donationAddr;
                controller.ViewBag.CoinSymbol         = _mc.GetCoin().CoinSymbol;
                controller.ViewBag.V3Logo             = _mc.GetCoin().V3Logo;
                controller.ViewBag.V3ThemeCss         = string.Empty;
                controller.ViewBag.GoalPosition       = _mc.GetCoin().GoalPosition;
                if (!string.IsNullOrEmpty(_mc.GetCoin().V3Theme))
                {
                    string str;
                    if (!_cache.TryGetValue(_mc.GetCoin().CoinSymbol + "_css_file", out str))
                    {
                        str = File.ReadAllText("wwwroot/" + _mc.GetCoin().V3Theme + ".min.css");
                        _cache.Set(_mc.GetCoin().CoinSymbol + "_css_file", str, _memoryCacheEntryOptions);
                    }
                    controller.ViewBag.V3ThemeCss = str;
                }
                controller.ViewBag.Claims = _mc.GetClaims();
                if (!string.IsNullOrEmpty(_mc.GetCoin().V3Layout))
                {
                    controller.ViewBag.V3Layout = string.Empty;
                }
                else
                {
                    controller.ViewBag.V3Layout = " " + _mc.GetCoin().V3Layout;
                }

                if (_mc.GetCoin().CoinImage == "-")
                {
                    controller.ViewBag.CSS = "default.css";
                }
                else
                {
                    controller.ViewBag.CSS = _mc.GetCoin().CoinID + ".css";
                }
                controller.ViewBag.IsClosed = false;
                if (!string.IsNullOrEmpty(_mc.GetCoin().FooterView))
                {
                    controller.ViewBag.FooterFile = "~/Views/Footer/" + _mc.GetCoin().FooterView + ".cshtml";
                }
                else
                {
                    controller.ViewBag.FooterFile = "~/Views/Footer/Default.cshtml";
                }
            }
        }