public static List<int> GetStudentGroups() { StudentsDataClassesDataContext dc = new StudentsDataClassesDataContext(); var queryResult = (from Students in dc.GetTable<Student>() select Students.Group).Distinct().ToList<int>(); return queryResult; }
//returns the information for a student with Faknum; else null; public static Student GetStudentDataByUser(string faknum) { StudentsDataClassesDataContext dc = new StudentsDataClassesDataContext(); var queryResult = (from Students in dc.GetTable<Student>() where (Students.FakNumber == faknum) select Students).ToArray<Student>(); if (queryResult.Count<Student>() > 0) { return queryResult[0]; } return null; }