public string delete(Student student)
 {
     if (!this.repository.exist(student.getMatriculation()))
     {
         return("Student does not exist!");
     }
     else
     {
         this.repository.remove(student);
         return("Deleted student!");
     }
 }
 public string create(Student student)
 {
     if (this.repository.exist(student.getMatriculation()))
     {
         return("Student is already registered!");
     }
     else
     {
         this.repository.insert(student);
         return("Student successfully registered!");
     }
 }
 public string modify(Student student)
 {
     if (!this.repository.exist(student.getMatriculation()))
     {
         return("Student does not exist!");
     }
     else
     {
         this.repository.update(student);
         return("Information was updated");
     }
 }
Exemple #4
0
 public void update(Student newStudent)
 {
     foreach (Student student in this.repository)
     {
         if (student.getMatriculation() == newStudent.getMatriculation())
         {
             student.setName(newStudent.getName());
             student.setSerie(newStudent.getSerie());
             student.setClassId(newStudent.getClassId());
             student.setTeacher(newStudent.getTeacher());
             student.setNote1(newStudent.getNote1());
             student.setNote2(newStudent.getNote2());
             student.setNote3(newStudent.getNote3());
             student.setNote4(newStudent.getNote4());
             student.setFinalNote(newStudent.getFinalNote());
         }
     }
 }