Ejemplo n.º 1
0
        public void CallService()
        {
            var bitCoin = new BitCoin(_endpointBitcoin);

            using (SolidDocTestEntities db = new SolidDocTestEntities())
            {
                var bitcoinPriceHistory = new BitcoinPriceHistory();
                bitcoinPriceHistory.CreateDate = bitCoin.CreateDate;
                bitcoinPriceHistory.LastPrice  = bitCoin.LastPrice;
                bitcoinPriceHistory.LastChange = bitCoin.LastChange;
                bitcoinPriceHistory.Volume     = bitCoin.Volume;
                bitcoinPriceHistory.HighPrice  = bitCoin.HighPrice;
                bitcoinPriceHistory.LowPrice   = bitCoin.LowPrice;

                db.BitcoinPriceHistories.Add(bitcoinPriceHistory);
                db.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            List <ListBitcoinPriceHistoryViewModel> lst;

            using (SolidDocTestEntities db = new SolidDocTestEntities())
            {
                lst = (from d in db.BitcoinPriceHistories
                       select new ListBitcoinPriceHistoryViewModel
                {
                    Id = d.Id,
                    CreateDate = d.CreateDate,
                    LastPrice = d.LastPrice,
                    LastChange = d.LastChange,
                    Volume = d.Volume,
                    HighPrice = d.HighPrice,
                    LowPrice = d.LowPrice
                }).ToList();
            }

            return(View(lst));
        }