public static StudentClassAvgViewData Create(Class @class, IEnumerable <ChalkableStudentAverage> studentAverages) { return(new StudentClassAvgViewData { Class = ShortClassViewData.Create(@class), StudentAverages = StudentAveragesViewData.Create(studentAverages.Where(z => !z.IsGradingPeriodAverage)), GradingPeriodAvg = StudentAveragesViewData.Create(studentAverages.First(z => z.IsGradingPeriodAverage)) }); }
public static StudentAveragesViewData Create(ChalkableStudentAverage studentAverage) { var res = new StudentAveragesViewData { AverageId = studentAverage.AverageId, CalculatedAlphaGrade = studentAverage.CalculatedAlphaGrade != null ? studentAverage.CalculatedAlphaGrade.Name : null, CalculatedAvg = studentAverage.CalculatedAvg, EnteredAlphaGrade = studentAverage.EnteredAlphaGrade != null ? studentAverage.EnteredAlphaGrade.Name : null, EnteredAvg = studentAverage.EnteredAvg, StudentId = studentAverage.StudentId, AverageName = studentAverage.AverageName, IsExempt = studentAverage.Exempt, MayBeExempt = studentAverage.MayBeExempt, Note = studentAverage.Note }; if (studentAverage.Comments != null) { res.Codes = studentAverage.Comments.Select(StudentAverageCommentViewData.Create).ToList(); } return(res); }