Exemple #1
0
        public IActionResult Index()
        {
            Students students = new Students();

            students.AverageGrade       = GradeList.Select(x => x.NumberGrade).Average();
            students.StudentGradeDetail = GradeList.GroupBy(x => x.LetterGrade).Select(g => new StudentGradeDetail()
            {
                LetterGrade      = g.Key,
                NumberOfStudents = g.Count()
            }).OrderBy(x => x.LetterGrade).ToList();
            students.ListOfStudents = GradeList;
            return(View(students));
        }
Exemple #2
0
 /// <summary>
 /// Calculate Average Grade Percentage for Class
 /// </summary>
 /// <returns></returns>
 private string CalculateAverageGradePercentage()
 {
     return(string.Format("{0}%", Math.Round(GradeList.Select(ng => ng.NumberGrade).Average(), 2)));
 }