コード例 #1
0
        public void WriteGoalsToTeamsTable(int teamID)
        {
            int        goalScored  = 0;
            int        goalAllowed = 0;
            Repository repo        = new Repository();
            var        games       = repo.DisplayLast3MatchForSearchedTeam(teamID);

            foreach (var game in games)
            {
                if (teamID == game.AwayTeamID)
                {
                    goalScored  += game.AwayScore;
                    goalAllowed += game.HomeScore;
                }
                else if (teamID == game.HomeTeamID)
                {
                    goalScored  += game.HomeScore;
                    goalAllowed += game.AwayScore;
                }
            }
            TempScoreTable temp = new TempScoreTable(teamID, goalScored, goalAllowed);

            temp.UpdateTeamsTable();
            Console.WriteLine(" Scored :" + goalScored + " Allowed:" + goalAllowed);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Games           game     = new Games();
            Repository      repo     = new Repository();
            TempScoreTable  temp     = new TempScoreTable();
            GamesRepository gamesRep = new GamesRepository();

            //game.DisplayGames();
            //game.DisplayTeamLast3GamesWithGoalForAndGoalAgainst();
            //game.FindHighestScoringTeamLast3Games();
            //game.DisplayLast3MatchForSearchedTeam();
            //repo.AddGamestoDatabase();
            //repo.AddMultipleGames();
            //temp.WriteAllTeamsToTempTable();
            gamesRep.GetTopScoringTeams();
        }