public NationalLeagueSeason CreateEuroLeague(IEnumerable<Team> championsLeagueClubs, IEnumerable<Team> europaLeagueClubs)
        {
            var league = new NationalLeague(world, "European Cups");

            var championsLeague = new League(league, "Champions League", 1, DayOfWeek.Wednesday, 2, hasReturnRound: false);
            championsLeague.AutomaticRelegationCount = 2;
            championsLeague.ConditionalRelegationCount = 2;
            league.AddDivision(championsLeague);

            var europaCup = new Cup(league, "Europa League", 2, DayOfWeek.Thursday, 2,
                new List<CupStage>
                {
                    new GroupStage(groupCount: 4, groupTeamCount: 4, groupPromotedCount: 2, isNeutralGround: false, hasReturnRound: true),
                    new TieKnockoutStage(4),
                    new TieKnockoutStage(2)
                });
            league.AddDivision(europaCup);

            league.PlayOffs = new LeaguePlayOffs(league, "European Play-Offs", DayOfWeek.Wednesday);

            DateTime startDate = new DateTime(world.StartYear, 08, 21);
            DateTime endDate = new DateTime(world.StartYear + 1, 05, 16);

            var leagueSeason = new NationalLeagueSeason(league, startDate, endDate);
            leagueSeason.AddDivisionSeason(new LeagueSeason((League)league.Divisions[0], startDate, endDate, championsLeagueClubs));
            leagueSeason.AddDivisionSeason(new CupSeason((Cup)league.Divisions[1], startDate, endDate, europaLeagueClubs));

            return leagueSeason;
        }
Example #2
0
        public League(NationalLeague league, string name, int level, DayOfWeek dayOfWeek, int frequency, bool hasReturnRound = true)
            : base(league, name, level)
        {
            DayOfWeek = dayOfWeek;
            Frequency = frequency;
            HasReturnRound = hasReturnRound;

            AutomaticPromotionCount = 1;
            ConditionalPromotionCount = 1;
            AutomaticRelegationCount = 1;
            ConditionalRelegationCount = 1;
        }
        public int CreateLeague(int worldId, string name, DateTime startDate, DateTime endDate)
        {
            var world = Context.Worlds.Find(worldId);
            var league = new NationalLeague(world, name);
            var leagueSeason = new NationalLeagueSeason(league, startDate, endDate);
            league.PlayOffs = new LeaguePlayOffs(league, name + " Play-offs", DayOfWeek.Wednesday);

            Context.NationalLeagues.Add(league);
            Context.NationalLeagueSeasons.Add(leagueSeason);
            Context.SaveChanges();

            return league.Id;
        }
 public NationalLeagueSeason(NationalLeague league, DateTime startDate, DateTime endDate)
     : base(league, startDate, endDate)
 {
     Divisions = new List<TournamentSeason>();
 }
 public LeaguePlayOffs(NationalLeague league, string name, DayOfWeek dayOfWeek)
     : base(league, name, 0)
 {
     DayOfWeek = dayOfWeek;
 }