static void ComplianceReport() { AttendanceControl.ComplianceReport().Save("C:\\Temp\\AttedanceCompliance.csv"); using (WebhostEntities db = new WebhostEntities()) { Faculty me = db.Faculties.Find(67); int studentCount = 0; foreach (Section section in me.Sections.Where(s => s.Course.AcademicYearID == 2016 && s.getsComments)) { Console.WriteLine("[{0}] {1} - {2}", section.Block.LongName, section.Course.Name, section.Students.Count); studentCount += section.Students.Count; } Console.WriteLine("Total Students: {0}", studentCount); Console.ReadKey(); } }