示例#1
0
 public void addStudent(UserAccount student)
 {
     if (!student.Id.HasValue || !this.Id.HasValue)
     {
         return;
     }
     if (StudentLinks.Any(link => link.UserAccountId == student.Id))
     {
         return;
     }
     StudentLinks.Add(new UserAccountToCourseLink()
     {
         Course = this, CourseId = this.Id.Value, UserAccount = student, UserAccountId = student.Id.Value
     });
 }
示例#2
0
 public void removeStudent(UserAccount student)
 {
     if (!student.Id.HasValue || !this.Id.HasValue)
     {
         return;
     }
     foreach (var link in StudentLinks)
     {
         if (link.UserAccountId == student.Id)
         {
             StudentLinks.Remove(link);
             return;
         }
     }
 }
示例#3
0
 public ICollection <UserAccount> GetStudents()
 {
     return(StudentLinks.Select(link => link.UserAccount).ToList());
 }