public ActionResult TeacherOrgList() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.OrgManager.TeacherOrgList(); var tb = db.Table <Course.Entity.tbOrgManager>(); if (!string.IsNullOrEmpty(vm.SearchText)) { tb = tb.Where(d => d.tbTeacher.TeacherName.Contains(vm.SearchText)); } if (vm.TeacherId > 0) { tb = tb.Where(d => d.tbTeacher.Id == vm.TeacherId); } vm.TeacherName = db.Set <Teacher.Entity.tbTeacher>().Find(vm.TeacherId).TeacherName; vm.DataList = (from p in tb orderby p.No select new Dto.OrgManager.TeacherOrgList() { Id = p.Id, No = p.No, OrgId = p.tbOrg.Id, OrgName = p.tbOrg.OrgName }).ToPageList(vm.Page); return(View(vm)); } }
public ActionResult TeacherOrgList(Models.OrgManager.TeacherOrgList vm) { return(Code.MvcHelper.Post(null, Url.Action("TeacherOrgList", new { searchText = vm.SearchText, pageIndex = vm.Page.PageIndex, pageSize = vm.Page.PageSize }))); }