Exemplo n.º 1
0
        public static void RegistCommand(this FootballStadiumService foot)
        {
            string[] command   = new[] { "Liverpool", "Manchester Untited", "Chelsea", "Fulham", "Real Madrid", "Barselona", "Juventus" };
            int      index     = Menu.IndexFootball();
            Random   rand      = new Random();
            int      first     = rand.Next(command.Length);
            string   firstTeam = command[first];

            Console.WriteLine("First team : " + command[first]);
            RemoveAt(ref command, first);
            int    second     = rand.Next(command.Length);
            string secondTeam = command[second];

            Console.WriteLine("Second team: " + command[second]);
            foot.ChangeComad(index, firstTeam, secondTeam);
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public void AddComandServ()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("Comand\n1. Add comand \n2.  Add command for index\n0.  Back");
                Console.Write("Action: ");
                string choise = Console.ReadLine();
                Console.Clear();
                switch (choise)
                {
                case "0":
                    return;

                case "1":
                    try
                    {
                        Console.WriteLine("Write nane of first comand");
                        string namefirst = validator.validator_name(Console.ReadLine());
                        Console.WriteLine("Write nane of second comand");
                        string namesecond = validator.validator_name(Console.ReadLine());
                        Fts.AddComand(namefirst, namesecond);
                    }
                    catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); }
                    break;

                case "2":
                    try
                    {
                        int index = IndexFootball();
                        Console.WriteLine("Write name of first comands");
                        string namefirst = validator.validator_name(Console.ReadLine());
                        Console.WriteLine("Write nane of second comand");
                        string namesecond = validator.validator_name(Console.ReadLine());
                        Fts.ChangeComad(index, namefirst, namesecond);
                    }
                    catch (Exception e) { Console.WriteLine(e.Message); Console.ReadKey(); }
                    break;

                default:
                    Console.WriteLine("Wrong index\nPress any key to continue...");
                    Console.ReadKey();
                    break;
                }
            }
        }