public void UpdateStudent(StudentVO studentVO) { var temp = GetStudent(studentVO.GetRollNo()); if (temp != null) { temp.SetName(studentVO.GetName()); } }
public void Main() { StudentBO studentBusinessObject = new StudentBO(); //输出所有的学生 for (int i = 0; i < studentBusinessObject.GetAllStudent().Count; i++) { Console.WriteLine("Name:" + studentBusinessObject.GetAllStudent()[i].GetName() + "RollNo:" + studentBusinessObject.GetAllStudent()[i].GetRollNo()); } //更新学生 StudentVO student = studentBusinessObject.GetAllStudent()[0]; student.SetName("Michael"); studentBusinessObject.UpdateStudent(student); //获取学生 student = studentBusinessObject.GetStudent(0); Console.WriteLine("Name:" + student.GetName() + "RollNo:" + student.GetRollNo()); }
public void DeleteStudent(StudentVO student) { _students.Remove(student); Console.WriteLine(student.GetName() + "--" + student.GetRollNo()); }