public static void UpdateTournamentResults(TournamentModel model) { int startingRound = model.checkCurrentRound(); List <MatchupModel> toScore = new List <MatchupModel>(); model.Rounds.ForEach(round => { round.ForEach(rm => { if ( //rm.Winner == null && (rm.Entries.Any(x => x.Score != 0) || rm.Entries.Count == 1)) { toScore.Add(rm); } }); }); MarkWinnersInMatchups(toScore); AdvanceWinners(toScore, model); toScore.ForEach(x => GlobalConfig.Connection.UpdateMatchup(x)); int endingRound = model.checkCurrentRound(); if (endingRound > startingRound) { model.AlertUsersToNewRound(); } }
public static void AlertUsersToNewRound(this TournamentModel model) { int currentRoundNumber = model.checkCurrentRound(); List <MatchupModel> currentRound = model.Rounds.Where(x => x.First().MatchupRound == currentRoundNumber).First(); currentRound.ForEach(matchup => { matchup.Entries.ForEach(me => { me.TeamCompeting.TeamMembers.ForEach(p => { AlertPersonToNewRound(p, me.TeamCompeting.TeamName, matchup.Entries.Where(x => x.TeamCompeting != me.TeamCompeting).FirstOrDefault()); }); }); }); }