Beispiel #1
0
        public void SaveMatch(string tournamentName, int roundNumber, string team1, string team2, string winningTeam)
        {
            Tournament currenttournament = tournamentRepository.GetTournament(tournamentName);

            Round Currentround = currenttournament.GetRound(roundNumber - 1);

            Match currentmatch = Currentround.GetMatch(team1, team2);

            if (currentmatch != null)
            {
                if (winningTeam == team1 || winningTeam == team2)
                {
                    currentmatch.Winner = currenttournament.GetTeam(winningTeam);
                    Console.WriteLine("Winner has been set");
                }
                else
                {
                    Console.WriteLine("The chosen winner is neither team 1 or 2");
                }
            }
            else
            {
                Console.WriteLine("Match not found");
            }
        }
Beispiel #2
0
        public string SaveMatch(string tournamentName, int roundNumber, string winningTeam)
        {
            TournamentRepo tr = new TournamentRepo();
            Tournament     t  = tr.GetTournament(tournamentName);
            Round          r  = t.GetRound(roundNumber - 1);
            Match          m  = r.GetMatch(winningTeam);

            if (m != null && m.Winner == null)
            {
                Team w = t.GetTeam(winningTeam);
                m.SetWinner(w);
                return("Du har opdateret vinder");
            }
            else
            {
                return("Der er sket en fejl");
            }
        }