// Raw Query using EF (get returned data into list of a provided model)
public IEnumerable<EnrollmentDateGroup> GetStudentStatistics()
{
var query = "SELECT EnrollmentDate, COUNT(*) AS StudentCount "
+ "FROM Person "
+ "WHERE EnrollmentDate IS NOT NULL "
+ "GROUP BY EnrollmentDate";
var data = context.Database.SqlQuery<EnrollmentDateGroup>(query);
return data.ToList();
}
// ========================= ADD MORE CODES HERE =========================