Example #1
0
        static void Main(string[] args)
        {
            var newGarage = new GaragHandler(2);

            Console.WriteLine("Please ENter the capacity of the new garage:");
            newGarage.Capacity = UI.InputIsInteger();

            newGarage.MainMenu();
            // if I enter number more than 5
        }
Example #2
0
        public static void MainMenu(this GaragHandler gh)
        {
            Console.Clear();
            Console.WriteLine($"YOU HAVE CREATED A GARAGE WITH MAX CAPACITY:{gh.Capacity}");
            Console.WriteLine("1-List all parked vehicles:"
                              + "\n2-List vehicle types and how many of each are in the garage: "
                              + "\n3-Adding vehicles from the garage:"
                              + "\n4-Removing vehicles from the garage by RegisterNumber:"
                              + "\n5-Find a specific vehicle through one or more properties:"
                              + "\n6-Please Enter 0 for exit from the program :"
                              );

            int input = InputIsInteger();

            switch (input)
            {
            case 0:
                Environment.Exit(0);
                break;

            case 1:
                do
                {
                    gh.PrintAll();
                } while (keepGoingOrGoBackOrexit());
                gh.MainMenu();
                break;

            case 2:
                do
                {
                    gh.PrintlistNumberOfType();
                } while (keepGoingOrGoBackOrexit());
                gh.MainMenu();
                break;

            case 3:
                do
                {
                    gh.AddVehicle();
                } while (keepGoingOrGoBackOrexit());
                gh.MainMenu();
                break;

            case 4:
                do
                {
                    if (gh.Count() == 0)
                    {
                        Console.WriteLine("your Garage is Empty");
                    }
                    else
                    {
                        Console.WriteLine("Please enter a Registration Number:");
                        string inputString = InputNotEMptyOrNull();
                        gh.RemoveVehicle(inputString);
                    }
                } while (keepGoingOrGoBackOrexit());
                gh.MainMenu();
                break;

            case 5:
                do
                {
                    gh.SearchMenu();
                } while (keepGoingOrGoBackOrexit());
                gh.MainMenu();
                break;
            }
        }