public StudentBO()
        {
            students = new List <StudentVO>();
            StudentVO student1 = new StudentVO("Robert", 0);
            StudentVO student2 = new StudentVO("John", 1);

            students.Add(student1);
            students.Add(student2);
        }
Example #2
0
        public static void Main(string[] args)
        {
            StudentBO studentBusinessObject = new StudentBO();

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

            //update student
            StudentVO student = studentBusinessObject.getAllStudents()[0];

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

            //get the student
            student = studentBusinessObject.getStudent(0);
            Console.WriteLine("Student: [RollNo : " + student.getRollNo() + ", Name : " + student.getName() + " ]");
        }
Example #3
0
        static void Main(string[] args)
        {
            StudentBO studentBusinessObject = new StudentBO();

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

            //更新学生
            StudentVO student = studentBusinessObject.getAllStudents().ElementAt(0);

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

            //获取学生
            studentBusinessObject.getStudent(0);
            Console.WriteLine("Student: [RollNo : "
                              + student.getRollNo() + ", Name : " + student.getName() + " ]");

            Console.ReadKey();
        }
 public void updateStudent(StudentVO student)
 {
     students.ElementAt(student.getRollNo()).setName(student.getName());
     Console.WriteLine("Student: Roll No "
                       + student.getRollNo() + ", updated in the database");
 }
 public void deleteStudent(StudentVO student)
 {
     students.RemoveAt(student.getRollNo());
     Console.WriteLine("Student: Roll No "
                       + student.getRollNo() + ", deleted from database");
 }