示例#1
0
        public void Begin()
        {
            do
            {
                MainMenu();
                option = Console.ReadLine();

                switch (option)
                {
                case "1":

                    PeopleController.PeopleModificationMenu();
                    option = Console.ReadLine();

                    if (option == "1")     // Add person
                    {
                        PeopleController.AddLogic();
                    }

                    else if (option == "2")     // Delete person
                    {
                        PeopleController.DeleteLogic();
                    }

                    else if (option == "3")     // View people
                    {
                        PeopleController.ViewLogic();
                    }

                    else if (option == "4")
                    {
                        MainMenu();
                    }
                    break;

                case "2":

                    LibraryController.LibraryMenu();
                    option = Console.ReadLine();

                    if (option == "1")
                    {
                        PeopleController.GetPerson(PeopleController.Person);
                        option = Console.ReadLine();


                        if (option == "1")
                        {
                            BooksController.BookModificationMenu();
                            option = Console.ReadLine();

                            if (option == "1")     // Add book
                            {
                                BooksController.AddLogic();
                            }

                            if (option == "2")     // Delete book
                            {
                                BooksController.DeleteLogic();
                            }

                            if (option == "3")     // View books
                            {
                                BooksController.ViewLogic();
                            }

                            if (option == "4")     // return to Library menu
                            {
                                LibraryController.LibraryModificationMenu();
                            }
                        }

                        else if (option == "2")
                        {
                            MagazineController.MagazineModificationMenu();
                            option = Console.ReadLine();


                            if (option == "1")     // Add magazine
                            {
                                MagazineController.AddLogic();
                            }

                            if (option == "2")     // Delete magazine
                            {
                                MagazineController.DeleteLogic();
                            }

                            if (option == "3")     // View magazine
                            {
                                MagazineController.ViewLogic();
                            }

                            if (option == "4")     // Return to Library menu
                            {
                                LibraryController.LibraryModificationMenu();
                            }
                        }

                        else if (option == "3")
                        {
                            MovieController.MovieModificationMenu();
                            option = Console.ReadLine();


                            if (option == "1")     // Add movie
                            {
                                MovieController.AddLogic();
                            }

                            if (option == "2")     // Delete movie
                            {
                                MovieController.DeleteLogic();
                            }

                            if (option == "3")     // View movie
                            {
                                MovieController.ViewLogic();
                            }

                            if (option == "4")     // Return to library menu
                            {
                                LibraryController.LibraryModificationMenu();
                            }
                        }
                    }

                    else if (option == "2")     // Delete library
                    {
                        LibraryController.DeleteLibrary(BooksController.Book, MovieController.Movie,
                                                        MagazineController.Magazine);
                    }

                    else if (option == "3")     // View library
                    {
                        LibraryController.ViewLogic();
                    }

                    else if (option == "4")     // return to Main menu
                    {
                        MainMenu();
                    }

                    break;

                case "3":     // Exit application

                    End();

                    break;

                default:
                    Console.WriteLine();
                    Console.WriteLine("Wrong option. Please re-enter\n");
                    break;
                }
            } while (repeat);
        }