Ejemplo n.º 1
0
        public ActionResult AddAwardAverage(GpcAwardAverage postModel)
        {
            var datastore = new GoogleCloudDatastore("Pogo");

            using (var session = datastore.OpenSession())
            {
                session.Store(postModel);
                session.SaveChanges();
            }

            return new EmptyResult();
        }
Ejemplo n.º 2
0
        public ActionResult AwardAverages(string id)
        {
            var datastore = new GoogleCloudDatastore("Pogo");

            using (var session = datastore.OpenSession())
            {
                var awards = session.Query<GpcAwardAverage>()
                    .Where(t => t.Company == id)
                    .ToList();

                return Json(awards, JsonRequestBehavior.AllowGet);
            }
        }
        public void WriteStockQuotes()
        {
            var target = new YahooFinance();
            string symbol = "KO";
            DateTime startDate = new DateTime(2014, 1, 1);
            DateTime endDate = new DateTime(2014, 3, 31);

            var results = target.GetHistoricalDailyStockQuotes(symbol, startDate, endDate);

            var datastore = new GoogleCloudDatastore("Pogo");

            using (var session = datastore.OpenSession())
            {
                foreach (var quote in results)
                {
                    session.Store(quote);
                }

                session.SaveChanges();
            }
        }
Ejemplo n.º 4
0
        public ActionResult StockPrices(string id)
        {
            var datastore = new GoogleCloudDatastore("Pogo");

            string symbol = _symbols[id];

            using (var session = datastore.OpenSession())
            {
                var prices = session.Query<DailyStockQuote>()
                    .Where(t => t.Symbol == symbol)
                    .ToList()
                    .OrderBy(t => t.Date); // GCD is throwing an error when trying to filter and order...

                return Json(prices, JsonRequestBehavior.AllowGet);
            }
        }