Exemplo n.º 1
0
        public static UIStateType Execute()
        {
            UIStateType nextState = UIStateType.LIST_ALL_BREWERIES;

            gBreweries = Brewery.GetBrewriesRequest(Service.httpClient);
            Brewery.PrintList(gBreweries);

            Console.WriteLine("Type '..' to go back!");
            Console.Write("Command (shoud be an integer between 0 and {0}): ", gBreweries.Count - 1);
            string command = Console.ReadLine();

            if (Int32.TryParse(command, out currentBrewery) == true)
            {
                if (currentBrewery >= 0 && currentBrewery < gBreweries.Count)
                {
                    nextState = UIStateType.LIST_BEERS_PER_BREWERY;
                }
                else
                {
                    Console.WriteLine("\nInvalid input!\n");
                    Console.ReadLine();
                }
            }
            else
            {
                if (command == "..")
                {
                    nextState = UIStateType.MAIN_MENU; // going back
                }
                else
                {
                    Console.WriteLine("\nInvalid input!\n");
                    Console.ReadLine();
                }
            }

            return(nextState);
        }
Exemplo n.º 2
0
 public Links2(Self2 self, Style style, Brewery brewery)
 {
     this.self    = self;
     this.style   = style;
     this.brewery = brewery;
 }