private static void createOtherRound(TournamentModel model, int numOfRounds) { int round = 2; List <MachUpModel> previewsModel = model.Rounds[0]; List <MachUpModel> currentRound = new List <MachUpModel>(); MachUpModel currentMatchUp = new MachUpModel(); while (round <= numOfRounds) { foreach (MachUpModel matchup in previewsModel) { currentMatchUp.Entries.Add(new MatchUpEtreyModel { parentMatchUp = matchup }); if (currentMatchUp.Entries.Count > 1) { currentMatchUp.MatchRound = round; currentRound.Add(currentMatchUp); currentMatchUp = new MachUpModel(); } } model.Rounds.Add(currentRound); previewsModel = currentRound; currentRound = new List <MachUpModel>(); round += 1; } }
private static List <MachUpModel> createFirstRound(int byes, List <TeamModel> teams) { List <MachUpModel> output = new List <MachUpModel>(); MachUpModel curr = new MachUpModel(); foreach (TeamModel tm in teams) { curr.Entries.Add(new MatchUpEtreyModel { teamCompleationg = tm }); if (byes > 0 || curr.Entries.Count > 1) { curr.MatchRound = 1; output.Add(curr); curr = new MachUpModel(); if (byes > 0) { byes -= 1; } } } return(output); }