public static List<MarkView> FromMarkList(List<Mark> list, List<MarkType> markTypes, List<MarkTypeOption> markTypeOptions, Dictionary<int, Teacher> teachers, MarkTeacherRepo mtRepo) { return list.Select(m => { var mw = new MarkView(m, markTypes, markTypeOptions, teachers); var marks = mtRepo.markAll(m.id); var teachersFio = (marks.Count == 0) ? "" : marks .Select(mt => teachers[mt.teacher_id].f + " " + teachers[mt.teacher_id].i + " " + teachers[mt.teacher_id].o) .Aggregate((a,b) => a + "; " + b); mw.teachersFio = teachersFio; return mw; }) .ToList(); }
public MarkList(string apiEndpoint) { ApiEndpoint = apiEndpoint; InitializeComponent(); mRepo = new MarkRepo(ApiEndpoint); mtRepo = new MarkTeacherRepo(ApiEndpoint); sRepo = new StudentRepo(ApiEndpoint); lpRepo = new LearningPlanRepo(ApiEndpoint); lpdRepo = new LearningPlanDisciplineRepo(ApiEndpoint); lpdsRepo = new LearningPlanDisciplineSemesterRepo(ApiEndpoint); mtypeRepo = new MarkTypeRepo(ApiEndpoint); mtoRepo = new MarkTypeOptionRepo(ApiEndpoint); tRepo = new TeacherRepo(ApiEndpoint); }