コード例 #1
0
 public Student AddNewStudent(Student newStudent)
 {
     if (newStudent == null)
         throw new ArgumentNullException("newStudent");
     newStudent.NoMahasiswa = counter++;
     students.Add(newStudent);
     return newStudent;
 }
コード例 #2
0
 public bool UpdateAStudent(Student updatedStudent)
 {
     if (updatedStudent == null)
         throw new ArgumentNullException("updatedStudent");
     int idx = students.FindIndex(b => b.NoMahasiswa == updatedStudent.NoMahasiswa);
     if (idx == -1)
         return false;
     students.RemoveAt(idx);
     students.Add(updatedStudent);
     return true;
 }
コード例 #3
0
 public string AddStudent(Student student, string NoMahasiswa)
 {
     Student newStudent = repo.AddNewStudent(student);
     return "Nomor Mahasiswa=" + newStudent.NoMahasiswa;
 }