public JsonResult JsonPartialTable(int?tradeId, int?toId)
        {
            if (tradeId != null && toId != null)
            {
                CryptoAPIResponseViewModelItens    objToView = new CryptoAPIResponseViewModelItens();
                List <CryptoAPIResponseModelItens> objTo     = _cryptoAPIService.SearchCoinsTradeId((int)toId);

                foreach (CryptoAPIResponseModelItens item in objTo)
                {
                    objToView.symbol    = item.symbol;
                    objToView.price_btc = item.price_btc;
                }


                List <CryptoAPIResponseViewModelForMarkets> objView = new List <CryptoAPIResponseViewModelForMarkets>();


                List <CryptoAPIResponseModelForMarkets> obj = _cryptoAPIService.SearchForMarket((int)tradeId);

                foreach (CryptoAPIResponseModelForMarkets item in obj.Where(q => q.quote == objToView.symbol).OrderBy(q => q.price))
                {
                    CryptoAPIResponseViewModelForMarkets viewMarket = new CryptoAPIResponseViewModelForMarkets()
                    {
                        name      = item.name,
                        quote     = item.quote,
                        price     = item.price,
                        price_usd = item.price_usd
                    };

                    objView.Add(viewMarket);
                }


                if (objView.Count > 0)
                {
                    return(Json(new { success = true, data = objView }, System.Web.Mvc.JsonRequestBehavior.AllowGet));
                }

                return(Json(new { success = false, data = objView }, System.Web.Mvc.JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { success = false, data = "" }, System.Web.Mvc.JsonRequestBehavior.AllowGet));
            }
        }
        public PartialViewResult _PartialTable(int?tradeId, int?toId)
        {
            CryptoAPIResponseViewModelItens objToView = new CryptoAPIResponseViewModelItens();

            if (tradeId != null && toId != null)
            {
                List <CryptoAPIResponseModelItens> objTo = _cryptoAPIService.SearchCoinsTradeId((int)toId);

                foreach (CryptoAPIResponseModelItens item in objTo)
                {
                    objToView.symbol    = item.symbol;
                    objToView.price_btc = item.price_btc;
                }


                List <CryptoAPIResponseViewModelForMarkets> objView = new List <CryptoAPIResponseViewModelForMarkets>();


                List <CryptoAPIResponseModelForMarkets> obj = _cryptoAPIService.SearchForMarket((int)tradeId);

                foreach (CryptoAPIResponseModelForMarkets item in obj.Where(q => q.quote == objToView.symbol).OrderBy(q => q.price))
                {
                    CryptoAPIResponseViewModelForMarkets viewMarket = new CryptoAPIResponseViewModelForMarkets()
                    {
                        name      = item.name,
                        quote     = item.quote,
                        price     = item.price,
                        price_usd = item.price_usd
                    };

                    objView.Add(viewMarket);
                }


                return(PartialView("_PartialTable", objView));
            }
            else
            {
                return(PartialView("_PartialTable", objToView));
            }
        }
        public JsonResult ListarEvolucaoMoeda(ChartCoinsFilter filter)
        {
            CryptoAPIResponseViewModelItens objToView = new CryptoAPIResponseViewModelItens();

            if (filter.CodTrade != 0 && filter.CodTo != 0)
            {
                List <CryptoAPIResponseModelItens> objTo = _cryptoAPIService.SearchCoinsTradeId((int)filter.CodTo);

                if (objTo.ToList().Count > 0)
                {
                    foreach (CryptoAPIResponseModelItens item in objTo)
                    {
                        objToView.symbol    = item.symbol;
                        objToView.price_btc = item.price_btc;
                    }
                }
                else
                {
                    return(Json(new { success = false, data = objTo }));
                }



                List <CryptoAPIResponseViewModelForMarkets> objView = new List <CryptoAPIResponseViewModelForMarkets>();


                List <CryptoAPIResponseModelForMarkets> obj = _cryptoAPIService.SearchForMarket((int)filter.CodTrade);

                foreach (CryptoAPIResponseModelForMarkets item in obj.Where(q => q.quote == objToView.symbol).OrderBy(q => q.time))
                {
                    double   tempoSegundo    = Convert.ToDouble(item.time);
                    TimeSpan tempoPercorrido = TimeSpan.FromSeconds(tempoSegundo);
                    DateTime dateTime        = DateTime.Today.Add(tempoPercorrido);


                    string displayTime = dateTime.ToString("HH:mm:ss");

                    CryptoAPIResponseViewModelForMarkets viewMarket = new CryptoAPIResponseViewModelForMarkets()
                    {
                        name      = item.name,
                        quote     = item.quote,
                        price     = item.price,
                        price_usd = item.price_usd,

                        time = displayTime
                    };

                    objView.Add(viewMarket);
                }


                if (objView.Count > 0)
                {
                    return(Json(new { success = true, data = objView }));
                }

                return(Json(new { success = false, data = objToView }));
            }
            else
            {
                return(Json(new { success = false, data = objToView }));
            }
        }