コード例 #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));
        }
コード例 #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()
            }));
        }