public void SetCollaboratorProfileOverviews(Project project) { foreach (var profile in project.CollaboratorProfiles) { if (profile is StudentProfile) { StudentProfileOverviews.Add(StudentProfileOverview.FromStudentProfile((StudentProfile)profile)); } else if (profile is FacultyMemberProfile) { FacultyMemberProfileOverviews.Add(FacultyMemberProfileOverview.FromFacultyMemberProfile((FacultyMemberProfile)profile)); } } }
public static StudentProfileOverview FromStudentProfile(StudentProfile profile) { StudentProfileOverview model = new StudentProfileOverview(); if (profile.Faculty != null) { model.FacultyName = profile.Faculty.Name; if (profile.StudyProgram != null) { model.StudyProgramName = profile.StudyProgram.Name; if (profile.StudyProgramSpecialization != null) { model.StudyProgramSpecializationName = profile.StudyProgramSpecialization.Name; } } } model.StudyCycle = profile.StudyCycle ?? null; model.StudyYear = profile.StudyYear ?? null; return(model); }