Example #1
0
        private void SeedDatabase()
        {
            var seasons = SeedDataTests.GetSeasonData();

            this.dbContext.Seasons.AddRange(seasons);

            var country = SeedDataTests.GetCountriesData();

            this.dbContext.Countries.Add(country);

            var league = SeedDataTests.GetLeaguesData();

            this.dbContext.Leagues.AddRange(league);

            var teams = SeedDataTests.GetTeamsData();

            this.dbContext.Teams.AddRange(teams);

            var fixtures = SeedDataTests.GetFixturesData();

            this.dbContext.Fixtures.AddRange(fixtures);

            var users = SeedDataTests.GetUsers();

            this.dbContext.Users.AddRange(users);

            this.dbContext.SaveChanges();

            var userOne = this.usersRepository.All().FirstOrDefault(x => x.UserName == "*****@*****.**").Id;
            var userTwo = this.usersRepository.All().FirstOrDefault(x => x.UserName == "*****@*****.**").Id;

            var predictions = SeedDataTests.GetPredictionsDataForUserOne(userOne);

            this.dbContext.Predictions.AddRange(predictions);


            var predictions2 = SeedDataTests.GetPredictionsDataForUserTwo(userTwo);

            this.dbContext.Predictions.AddRange(predictions2);

            this.dbContext.SaveChanges();
        }
        private void SeedDatabase()
        {
            var country = SeedDataTests.GetCountriesData();

            this.dbContext.Countries.Add(country);

            var seasons = SeedDataTests.GetSeasonData();

            this.dbContext.Seasons.AddRange(seasons);

            var leagues = SeedDataTests.GetLeaguesData();

            this.dbContext.Leagues.AddRange(leagues);

            var teams = SeedDataTests.GetTeamsData();

            this.dbContext.Teams.AddRange(teams);


            this.dbContext.SaveChanges();
        }