示例#1
0
        public void Sentry()
        {
            APIHandler   webHandler = new APIHandler();
            SentryObject sentryData = webHandler.GetSentryObjects();

            int x = 1;

            foreach (Sentry s in sentryData.data)
            {
                IQueryable <Sentry> sentest = dbContext.SentryEntries
                                              .Where(c => c.id == s.id);

                if (sentest == s | sentest.Count() == 0)
                {
                    s.num = x;
                    x++;
                    dbContext.SentryEntries.Add(s);
                }
                else
                {
                    s.num = x;
                    x++;
                    dbContext.SentryEntries.Update(s);
                }
            }
            dbContext.SaveChanges();
        }
示例#2
0
        public IActionResult Sentry()
        {
            //this will prob need to be changed so as to load only a few objects or something
            //APIHandler is a class
            APIHandler   webHandler = new APIHandler();
            SentryObject sentryData = webHandler.GetSentryObjects();

            foreach (Sentry s in sentryData.data)
            {
                dbContext.SentryEntries.Add(s);
            }
            dbContext.SaveChanges();

            return(View(sentryData));
        }