Example #1
0
        public static void SetTeacher()
        {
            Console.WriteLine("Enter Id of a teacher(id should be numbers)");
            int id = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter name of the teacher");
            string name = Console.ReadLine();

            Console.WriteLine("Enter class and section of a teacher");
            string cls = Console.ReadLine();

            TeacherCRUD.AddTeacher(id, name, cls);
        }
Example #2
0
        public static void UpdateTeacher()
        {
            Console.WriteLine("Enter id");
            int id = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter Name to be corrected");
            string name = Console.ReadLine();

            Console.WriteLine("Enter Class and Section to be updated");
            string  cls = Console.ReadLine();
            Teacher t   = new Teacher(id, name, cls);

            TeacherCRUD.UpdateTeacher(t);
        }
Example #3
0
        public static void SearchTeacherById()
        {
            Console.WriteLine("Enter id(id should be numbers)");
            int     id = Convert.ToInt32(Console.ReadLine());
            Teacher t  = TeacherCRUD.GetTeacherById(id);

            if (t == null)
            {
                Console.WriteLine("Id does not exist");
            }
            else
            {
                Console.WriteLine($"Name: {t.Name}\t Class And Section: {t.ClassAndSection}");
            }
        }
Example #4
0
        public static void ShowAllTeacher()
        {
            List <Teacher> list = TeacherCRUD.GetAllTeachers();

            if (list.Count == 0)
            {
                Console.WriteLine("No data");
            }
            else
            {
                foreach (Teacher t in list)
                {
                    Console.WriteLine($"ID: {t.ID}\tName: {t.Name}\tClass And Section: {t.ClassAndSection}");
                }
            }
        }