Beispiel #1
0
        public void studentMenuActive()
        {
            StudentManager stuManager = new StudentManager();

            do
            {
                Console.WriteLine("\n------------------------------------------------------------" +
                                  "\nStudent menu:  1.List students    2.Staff availability    3.Make booking    4.Delete booking   5.Exit");
                Console.WriteLine("Enter option: ");
                var option = int.Parse(Console.ReadLine());
                switch (option)
                {
                case 1:
                    stuManager.ListStudent();
                    break;

                case 2:
                    stuManager.StaffAvaliability();
                    break;

                case 3:
                    stuManager.MakeBooking();
                    break;

                case 4:
                    stuManager.CancelBooking();
                    break;

                case 5:
                    return;

                default:
                    Console.WriteLine("Invalid input, please enter again");
                    break;
                }
            } while (true);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            int            choice = 0;
            StudentManager sm     = new StudentManager();

            do
            {
                Console.WriteLine("1.Add a student");
                Console.WriteLine("2.Display all student");
                Console.WriteLine("3.Search a student by ID");
                Console.WriteLine("4.Update a student");
                Console.WriteLine("5.Exit");
                while (true)
                {
                    try
                    {
                        Console.WriteLine("Input your choice");
                        choice = int.Parse(Console.ReadLine());
                        if (choice < 0 || choice > 5)
                        {
                            throw new Exception();
                        }
                        break;
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("Please input your choice again !");
                    }
                }

                switch (choice)
                {
                case 1:
                {
                    sm.addStudent();
                    break;
                }


                case 2:
                {
                    sm.displayStudent();
                    break;
                }

                case 3:
                {
                    sm.searchStudent();
                    break;
                }

                case 4:
                    break;


                case 5:
                    break;
                }
            } while (choice != 5);


            Console.ReadKey();
        }