SHARE
TWEET

Untitled

a guest Jun 25th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2. GL.Id as GradeLevels, CRS.Name as CourseName, GL.Title as GradlevelName, avg(ASTSTU.ObtainedMarks) FROM
  3. GradeLevels AS GL
  4.     inner JOIN
  5. Courses AS CRS ON CRS.GradeLevelsID = GL.Id
  6.     inner JOIN
  7. Units AS UNT ON UNT.CourseID = CRS.ID
  8.     inner JOIN
  9. Lessons AS LSN ON LSN.UnitsId = UNT.Id
  10.     inner JOIN
  11. Assignments AST ON AST.LessonId = LSN.id
  12.     inner JOIN
  13. AssignmentStudents ASTSTU ON ASTSTU.AssignmentId = AST.id
  14.  WHERE
  15. CRS.SchoolSystemsID = "08d6a1f2-26df-4ad5-25d3-2a26960aa3fd"  //School System id.
  16.                 GROUP BY GL.Id;
  17.      
  18. public async Task<ICollection<GradeLevels>> GetSchoolSystemGradLevelsAverage(Guid schoolSystemId)
  19.     {
  20.         List<GradeLevels> dashboadOverAllAverage = new List<GradeLevels>();
  21.  
  22.         var dashboadOverAllAverage1 = await _GpsContext.GradeLevels
  23.             .Include(d=>d.Departments)
  24.             .ThenInclude(c=>c.Courses.Where(s=>s.SchoolSystemsID ==schoolSystemId))
  25.             .ThenInclude(u=>u.Units)
  26.             .ThenInclude(l=>l.Lessons)
  27.             .ThenInclude(a=>a.Assignment)
  28.             .ThenInclude(a=>a.assignmentStudents)
  29.             .GroupBy(g=>g.ID)
  30.             .ToListAsync();
  31.         return dashboadOverAllAverage;
  32.     }
  33.      
  34. [HttpGet()]
  35.     public async Task<IActionResult> GetCEOGradeLevelAverage(string schoolSystemId)
  36.     {
  37.         var overallgradeAverages = await _ceoDashboadRepository.GetSchoolSystemGradLevelsAverage(Guid.Parse(schoolSystemId));
  38.         List<GetGradeLevelAverageVm> getOverallAverageVms = new List<GetGradeLevelAverageVm>();
  39.  
  40.         foreach (GradeLevels overallgradeAverage in overallgradeAverages)
  41.         {
  42.             getOverallAverageVms.Add(new GetGradeLevelAverageVm
  43.             {
  44.                 Marks = overallgradeAverage.Id.ToString(), //Want to show lable of AvrageMark
  45.                 Name = overallgradeAverage.Name //Want to show Gradelevel name
  46.             });
  47.         }
  48.         return Ok(getOverallAverageVms);
  49.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top