Пример #1
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));
        }