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(); }
private void UpdateMarkTeachersList(MarkView markView) { var marksTeachers = mtRepo.markAll(markView.id); var teachers = tRepo.all(); var markTeachersView = MarkTeacherView.FromMarkTeacherList(marksTeachers, teachers); MarksTeachersGrid.DataSource = markTeachersView; FormatMarksTeachersGrid(); }