Ejemplo n.º 1
0
 public IActionResult Address(string address, int?pagenum = null, bool?unconfirmed = false)
 {
     try
     {
         var addressInfo = mainCoins.GetAddressInfo(address);
         if (addressInfo == null && mainCoins.IsValidAddres(address))
         {
             return(View(new AddressViewModel()
             {
                 Address = address,
                 AddressInfo = new AddressInfo()
                 {
                     Address = address,
                     Received = 0.0m,
                     Id = "",
                     Sent = 0.0m,
                     Total = 0.0m,
                     Transactions = 0
                 },
                 MainCoinModel = mainCoins.GetCoin()
             }));
         }
         var           mc   = mainCoins.GetCoin();
         ExchangePrice ep   = exchange.GetMarketprice(mc.CoinSymbol.ToUpper());
         ExchangeFiat  fiat = exchange.GetMarketFiat();
         return(View(new AddressViewModel()
         {
             Address = addressInfo.AddressInfo.Address,
             AddressInfo = addressInfo.AddressInfo,
             MainCoinModel = mc,
             ExchangeFiat = fiat,
             ExchangePrice = ep,
             IsUnconfirmed = unconfirmed.GetValueOrDefault()
         }));
     }
     catch
     {
         return(View("~/Views/Shared/Error.cshtml", new ErrorViewModel {
             RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier
         }));
     }
 }
Ejemplo n.º 2
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
            }));
        }