Example #1
0
        public static List <LeagueUser> AddUsersToLeague(League league, int count, ApplicationDbContext dbContext)
        {
            var users = DbContextUtility.AddNewRange <ApplicationUser>(dbContext, count);

            return(DbContextUtility.AddNewRange <LeagueUser>(dbContext, count, (lu, i) =>
            {
                lu.UserID = users[i].Id;
                lu.LeagueID = league.ID;
            }));
        }
Example #2
0
        public static (Season season, List <LeagueUser> members) CreateSeason(ApplicationDbContext dbContext, int participants)
        {
            var league  = LeagueUtility.CreateLeague(dbContext);
            var members = LeagueUtility.AddUsersToLeague(league, participants, dbContext);

            var season = DbContextUtility.AddNew <Season>(dbContext, s => s.LeagueID = league.ID);

            DbContextUtility.AddNewRange <SeasonLeagueUser>(dbContext, participants, (slu, i) =>
            {
                slu.LeagueUserID = members[i].ID;
                slu.SeasonID     = season.ID;
            });

            return(season, members);
        }