예제 #1
0
        public async Task Create()
        {
            string name;

            while (true)
            {
                Console.WriteLine("\nName of the tournament:");
                name = Console.ReadLine();
                if (!TournamentExists(name))
                {
                    break;
                }
                Console.WriteLine("Tournament with this name already exists");
            }
            int minPlayers = StaticMethods.ReadNumber("\nMinimum players per team:");
            int maxPlayers = StaticMethods.ReadNumber("\nMaximum players per team:");

            Console.WriteLine("\nArea of the tournament:");
            string area = Console.ReadLine();

            actualTournament = new Tournament(name, minPlayers, maxPlayers, area);

            var newCategories = new CreateCategories(actualTournament);

            newCategories.AddCategories();

            Console.WriteLine("\nYou can add players:");
            var newPlayers = new AddPlayers(actualTournament);
            await newPlayers.StartAdding();

            tournaments.Add(actualTournament);
        }
예제 #2
0
        public async Task Edit()
        {
            bool done = false;

            while (!done)
            {
                Console.WriteLine("\nYou can add category or players:");
                Console.WriteLine("'0' - Back");
                Console.WriteLine("'1' - Add category");
                Console.WriteLine("'2' - Add players");
                Console.WriteLine("'3' - Start tournament");

                lineToRead = Console.ReadLine();

                if (lineToRead.Length != 0)
                {
                    switch (lineToRead[0])
                    {
                    case '1':
                    {
                        var newCategories = new CreateCategories(tournament);
                        newCategories.AddCategories();
                        break;
                    }

                    case '2':
                    {
                        var addingPlayers = new AddPlayers(tournament);
                        await addingPlayers.StartAdding();

                        break;
                    }

                    case '3': StartTournament(); done = true; break;

                    case '0': done = true; break;

                    default: Console.WriteLine("Wrong input!"); break;
                    }
                }
            }
        }