public JsonResult GetCourse(string name, int page, int pageSize) { var ListCourse = new CourseDAO().GetCOURSEs().Select(x => new { ID = x.ID, NAME = x.NAME, DESCRIPTION = x.DESCRIPTION, SUBJECT = new SUBJECT { FACULTY_ID = x.SUBJECT.FACULTY_ID } }); if (!string.IsNullOrEmpty(name)) { ListCourse = ListCourse.Where(x => x.NAME.Contains(name)); } int TotalRow = ListCourse.Count(); var lstCourse = ListCourse.Skip((page - 1) * pageSize).Take(pageSize); return(Json(new { total = TotalRow, data = lstCourse, status = true }, JsonRequestBehavior.AllowGet)); }