// The return type can be changed to IEnumerable, however to support // paging and sorting, the following parameters must be added: // int maximumRows // int startRowIndex // out int totalRowCount // string sortByExpression public IQueryable <ManageStudent.Models.Class> GetClasses() { var _db = new ManageStudent.Models.StudentContext(); IQueryable <Class> query = _db.Classes; return(query); }
public IQueryable <Student> GetStudents([QueryString("id")] int?classID) { var _db = new ManageStudent.Models.StudentContext(); IQueryable <Student> query = _db.Students; if (classID.HasValue && classID > 0) { query = query.Where(p => p.ClassID == classID); } return(query); }