public static void Main(string[] args)
        {
            StudentDao studentDao = new StudentDaoImpl();

            //print all students
            foreach (Student studentItem in studentDao.getAllStudents())
            {
                Console.WriteLine("Student: [RollNo : " + studentItem.getRollNo() + ", Name : " + studentItem.getName() + " ]");
            }

            //update student
            Student student = studentDao.getAllStudents()[0];

            student.setName("Michael");
            studentDao.updateStudent(student);

            //get the student
            studentDao.getStudent(0);
            Console.WriteLine("Student: [RollNo : " + student.getRollNo() + ", Name : " + student.getName() + " ]");
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            StudentDao studentDao = new StudentDaoImpl();

            //输出所有的学生
            foreach (var student1 in studentDao.getAllStudents())
            {
                Console.WriteLine($"Student: [RollNo :{student1.getRollNo()}, Name :{student1.getName()}]");
            }

            //更新学生
            Student student = studentDao.getAllStudents().ElementAt(0);

            student.setName("Michael");
            studentDao.updateStudent(student);

            //获取学生
            studentDao.getStudent(0);
            Console.WriteLine($"Student: [RollNo :{student.getRollNo()}, Name :{student.getName()}]");
            Console.ReadKey();
        }