public ActionResult AddClassStudentToGroup(int classId, int classGroupId) { var vm = new Models.ClassGroup.AddClassStudentToGroup(); vm.ClassGroupId = classGroupId; vm.ClassId = classId; using (var db = new XkSystem.Models.DbContext()) { var tb = db.Table <Basis.Entity.tbClassStudent>() .Include(d => d.tbStudent) .Include(d => d.tbStudent.tbSysUser.tbSex) .Include(d => d.tbClassGroup) .Where(d => d.tbClass.Id == classId); if (!string.IsNullOrEmpty(vm.SearchText)) { tb = tb.Where(d => d.tbStudent.StudentName.Contains(vm.SearchText) || d.tbStudent.StudentCode.Contains(vm.SearchText)); } vm.ClassStudentList = (from p in tb orderby p.No select new Dto.ClassGroup.AddClassStudentToGroup() { Id = p.Id, ClassGroupName = p.tbClassGroup.ClassGroupName, StudentCode = p.tbStudent.StudentCode, StudentName = p.tbStudent.StudentName, SexName = p.tbStudent.tbSysUser.tbSex.SexName }).ToPageList(vm.Page); } return(View(vm)); }
public ActionResult AddClassStudentToGroup(Models.ClassGroup.AddClassStudentToGroup vm) { return(Code.MvcHelper.Post(null, Url.Action("AddClassStudentToGroup", new { searchText = vm.SearchText, ClassGroupId = vm.ClassGroupId, ClassId = vm.ClassId, pageIndex = vm.Page.PageIndex, pageSize = vm.Page.PageSize }))); }