/// <summary> /// /// </summary> public void ShowAverageForAllStudents() { var weeks = from l in _hwRepo.FindAll() select l.DeadlineWeek - l.ReceivingWeek; var totalWeeks = weeks.Sum(); var average = (from r in _grRepo.FindAll() group r by r.GetStudId() into studentGroup select new { studentId = studentGroup.Key, studName = _stRepo.FindOne(studentGroup.Key).Name, studentFinalGrade = (from sg in studentGroup from l in _hwRepo.FindAll() where sg.GetHwId() == l.Id select(l.DeadlineWeek - l.ReceivingWeek) * sg.GradeValue ).Sum() / totalWeeks, } ); foreach (var a in average) { Console.WriteLine(a); } }
public static List <Category> FindAll(AbstractRepository repo) { return(repo.FindAll <Category>()); }
/// <summary> /// Function to get all homework from the repository /// </summary> /// <returns>an IEnumerable containing all homework from the repository</returns> public IEnumerable <Homework> GetAllHomework() { return(_hwRepo.FindAll()); }
public static List <Format> FindAll(AbstractRepository repo) { return(repo.FindAll <Format>()); }
/// <summary> /// Function to get all the grades from the repository /// </summary> /// <returns>IEnumerable containing all grades from the repository</returns> public IEnumerable <Grade> GetAllGrades() { return(_grRepo.FindAll()); }
/// <summary> /// Function to get all students as Enumerable /// </summary> /// <returns>Returns an Enumerable containing all students</returns> public IEnumerable <Student> GetAllStudents() { return(_studRepo.FindAll()); }