Beispiel #1
0
 public static TestResultItemListViewModel FromStudent(Student student, HtmlString marks,
                                                       IEnumerable <Test> tests)
 {
     return(new TestResultItemListViewModel
     {
         Login = student.User.UserName,
         StudentName = student.FullName,
         StudentShortName = GetShortStudentName(student),
         Marks = marks,
         TestPassResults = student.User.TestPassResults.Select(x =>
                                                               TestPassResultViewModel.FromModel(x, tests.FirstOrDefault(y => y.Id == x.TestId))).ToArray()
     });
 }
Beispiel #2
0
 public static TestResultItemListViewModel FromStudent(Student student, IEnumerable <Test> tests,
                                                       IList <SubGroup> subGroups)
 {
     return(new TestResultItemListViewModel
     {
         Login = student.User.UserName,
         StudentName = student.FullName,
         StudentShortName = GetShortStudentName(student),
         TestPassResults = student.User.TestPassResults.Where(x => tests.Any(y => y.Id == x.TestId))
                           .Select(x => TestPassResultViewModel.FromModel(x, tests.FirstOrDefault(y => y.Id == x.TestId)))
                           .OrderBy(x => x.TestNumber).ToArray(),
         SubGroup = subGroups.FirstOrDefault(x => x.SubjectStudents.Any(y => y.StudentId == student.Id)) != null
             ? subGroups.FirstOrDefault(x => x.SubjectStudents.Any(y => y.StudentId == student.Id)).Name
             : ""
     });
 }