Beispiel #1
0
        private static void GetBoard(ScoreBoard scoreBoard)
        {
            List <Game> board = scoreBoard.GetBoard();

            board.ForEach(game =>
            {
                Console.WriteLine($"\n {game.HomeTeam.Name} - {game.AwayTeam.Name}: {game.Score.Home} - {game.Score.Away}");
            });
        }
Beispiel #2
0
        private static void FinishGame(ScoreBoard scoreBoard)
        {
            Console.Write("Home team name:");
            string homeTeamName = Console.ReadLine();

            Console.Write("Away team name:");
            string awayTeamName = Console.ReadLine();

            scoreBoard.FinishGame(homeTeamName, awayTeamName);
        }
Beispiel #3
0
        private static void Main(string[] args)
        {
            ScoreBoard scoreBoard = SetUp(args);

            int option = 0;

            while (option != 5)
            {
                Console.WriteLine("\n----- FOOTBALL WORD CUP SCORE BOARD -----");
                Console.WriteLine("1. Start Game");
                Console.WriteLine("2. Update Game");
                Console.WriteLine("3. Finish Game");
                Console.WriteLine("4. Get Board");
                Console.WriteLine("5. Exit");
                Console.Write("Choose an option: ");

                try
                {
                    option = int.Parse(Console.ReadLine());

                    switch (option)
                    {
                    case 1:
                        StartGame(scoreBoard);
                        break;

                    case 2:
                        UpdateGame(scoreBoard);
                        break;

                    case 3:
                        FinishGame(scoreBoard);
                        break;

                    case 4:
                        GetBoard(scoreBoard);
                        break;

                    default:
                        Console.WriteLine("Please choose an option between 1 and 5");
                        break;
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("Option must be a number");
                }
            }
        }
Beispiel #4
0
        private static void UpdateGame(ScoreBoard scoreBoard)
        {
            Console.Write("Home team name:");
            string homeTeamName = Console.ReadLine();

            Console.Write("Away team name:");
            string awayTeamName = Console.ReadLine();

            Console.Write("Home score:");
            string homeScore = Console.ReadLine();

            Console.Write("Away score:");
            string awayScore = Console.ReadLine();

            scoreBoard.UpdateScoreGame(homeTeamName, awayTeamName, int.Parse(homeScore), int.Parse(awayScore));
        }