Пример #1
0
        public void Run()
        {
            ShowCommands();
            string command;

            while (true)
            {
                command = Console.ReadLine();

                string   commandName = command.Split(' ')[0];
                string[] parameters  = command.Split(' ');

                if (commandName.Equals("playersTeam"))
                {
                    long teamId = long.Parse(parameters[1]);
                    Team team   = new Team()
                    {
                        ID = teamId
                    };
                    List <Player> players = serviceApp.AllPlayersInATeam(team);
                    foreach (var player in players)
                    {
                        Console.WriteLine(player);
                    }
                }
                if (commandName.Equals("activePlayersTeam"))
                {
                    long teamId  = long.Parse(parameters[1]);
                    long matchId = long.Parse(parameters[2]);
                    Team team    = new Team()
                    {
                        ID = teamId
                    };
                    Match match = new Match()
                    {
                        ID = matchId
                    };
                    List <Player> allActivePlayers = serviceApp.AllActivePlayersInTeamMatch(team, match);

                    foreach (var activePlayer in allActivePlayers)
                    {
                        Console.WriteLine(activePlayer);
                    }
                }
                if (commandName.Equals("matchesPeriod"))
                {
                    string startPeriod = parameters[1];
                    string endPeriod   = parameters[2];

                    List <String> matchesPeriod = serviceApp.AllMatchesInPeriod(DateTime.Parse(startPeriod), DateTime.Parse(endPeriod));

                    foreach (var match in matchesPeriod)
                    {
                        Console.WriteLine(match);
                    }
                }
                if (commandName.Equals("scoreMatch"))
                {
                    long  idMatch = long.Parse(parameters[1]);
                    Match match   = new Match()
                    {
                        ID = idMatch
                    };

                    Console.WriteLine(serviceApp.ScoreMatch(match));
                }
            }
        }