public ActionResult Statistics() { var subjects = unitOfWork.SubjectRepository.Get().ToList(); List <SubjectStatistic> studentsStatistics = new List <SubjectStatistic>(); subjects.ForEach(s => { SubjectStatistic subjectStatistic = new SubjectStatistic(); subjectStatistic.Name = unitOfWork.SubjectRepository.GetByID(s.ID).Name; subjectStatistic.ID = s.ID; var enrollements = unitOfWork.EnrollmentRepository .Get() .Where(e => e.SubjectID == s.ID) .ToList(); enrollements.ForEach(e => { subjectStatistic.Students.Add(new StudentGrade { Name = unitOfWork.StudentRepository.GetByID(e.StudentID).Name, Grade = e.GradeValue }); }); studentsStatistics.Add(subjectStatistic); }); return(Json(studentsStatistics, JsonRequestBehavior.AllowGet)); }
public SubjectStatisticWithDetail(string ico) { Statistic = new SubjectStatistic(ico); }
public SubjectStatisticWithDetail(Lib.Data.Firma subject) { Statistic = new SubjectStatistic(subject.ICO); }