public void InitializeDbForTests()
 {
     _db.Users.AddRange(
         // add some users here
         );
     _db.SaveChanges(true);
 }
Beispiel #2
0
        public void UpdateFromApi(GatewayContext context)
        {
            var searchPages = 1000;

            for (int i = 0; i < searchPages; i++)
            {
                Console.WriteLine("Loading Page " + i);
                var usergates = new List <UserGate>();
                var users     = new List <User>();
                searchPages = ProcessApiUsers(context, i, users, usergates);
                Console.WriteLine("All Data for Page " + i + " Loaded Successfully. Updating");
                users.ForEach(s => context.Users.AddOrUpdate(s));
                usergates.ForEach(s => context.UserGates.AddOrUpdate(s));
                context.SaveChanges();
                Console.WriteLine("Loaded page " + i + " successfully");
            }
            Console.WriteLine("Leaderboard update has successfully completed! There was about " + searchPages * 100 + " users processed");
        }
Beispiel #3
0
        public void CreateGates(GatewayContext context)
        {
            var courses = new List <Gate>
            {
                new Gate {
                    GateID = 1, Theme = "Nintendo", Keys = 5
                },
                new Gate {
                    GateID = 2, Theme = "Indie Games", Keys = 4
                },
                new Gate {
                    GateID = 3, Theme = "Unknown", Keys = 0
                },
                new Gate {
                    GateID = 4, Theme = "Unknown", Keys = 0
                },
                new Gate {
                    GateID = 5, Theme = "Unknown", Keys = 0
                },
                new Gate {
                    GateID = 6, Theme = "Unknown", Keys = 0
                },
                new Gate {
                    GateID = 7, Theme = "Unknown", Keys = 0
                },
                new Gate {
                    GateID = 8, Theme = "BETA GATE 1", Keys = 0
                },
                new Gate {
                    GateID = 9, Theme = "BETA GATE 2", Keys = 0
                },
                new Gate {
                    GateID = 10, Theme = "BETA GATE 3", Keys = 0
                },
            };

            courses.ForEach(s => context.Gates.AddOrUpdate(s));
            context.SaveChanges();
        }