/// <summary> /// Displays all students test results for one chosen test in the StudentResultView /// </summary> /// <param name="testId"></param> public void DisplayStudentResult(int testId) { DisplayResult.Clear(); foreach (TestResult tr in StudentTestResults.ToList()) { foreach (Student student in AllStudents) { if (tr.TestId == testId && student.StudentId == tr.StudentId) { DisplayResult.Add($"TestId: {tr.TestId}\nNamn: {student.FirstName} {student.LastName}\nPoäng: {tr.TotalPoints}"); } } } }
/// <summary> /// Displays all the tests that have been finished /// </summary> public void DisplayAllTests() { GradedTests.Clear(); foreach (TestResult tr in StudentTestResults.ToList()) { foreach (Test t in AllTests.ToList()) { if (t.TestId == tr.TestId && !GradedTests.Contains(t)) { GradedTests.Add(t); } } } }