Exemple #1
0
        static void Main(string[] args)
        {
            ctx = new ParkingDbContext(); // exceptions?
            int choice = 0;

            do
            {
                choice = GetMenuChoice();
                switch (choice)
                {
                case 1: ListAllCarsAndTheirOwners(); break;

                case 2: ListAllOwnersAndTheirCars(); break;

                case 3: AddACar_NoOwner(); break;

                case 4: AddAnOwner_NoCars(); break;

                case 5: AssignCarToAnOwnerOrNoOwner(); break;

                case 6: DeleteAnOwnerWithAllCarsTheyOwn(); break;

                case 0: break;     // Quit
                }
                Console.WriteLine();
            } while (choice != 0);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            ctx = new ParkingDbContext();

            int choice;

            do
            {
                choice = GetMenuChoice();
                switch (choice)
                {
                case 1:
                    ListCarsAndOwners();
                    break;

                case 2:
                    ListOwnersAndCars();
                    break;

                case 3:
                    AddCar();
                    break;

                case 4:
                    AddOwner();
                    break;

                case 5:
                    AssignCarToOwner();
                    break;

                case 6:
                    DeleteOwnerAndHisCars();
                    break;

                case 0:     // exit
                    break;

                default:     // ALWAYS have a default handler in switch/case
                    Console.WriteLine("Invalid choice try again.");
                    break;
                }
                Console.WriteLine();
            } while (choice != 0);
        }