public Student AddNewStudent(Student newStudent) { if (newStudent == null) throw new ArgumentNullException("newStudent"); newStudent.NoMahasiswa = counter++; students.Add(newStudent); return newStudent; }
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; }
public string AddStudent(Student student, string NoMahasiswa) { Student newStudent = repo.AddNewStudent(student); return "Nomor Mahasiswa=" + newStudent.NoMahasiswa; }