public ActionResult List() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.OrgTeacher.List(); var org = (from p in db.Table <Course.Entity.tbOrg>() where p.Id == vm.OrgId select p).FirstOrDefault(); if (org != null) { var tb = from p in db.Table <Course.Entity.tbOrgTeacher>() where p.tbOrg.Id == vm.OrgId select p; if (string.IsNullOrEmpty(vm.SearchText) == false) { tb = tb.Where(d => d.tbTeacher.TeacherCode.Contains(vm.SearchText) || d.tbTeacher.TeacherName.Contains(vm.SearchText)); } vm.OrgTeacherList = (from p in tb orderby p.tbTeacher.TeacherName select new Dto.OrgTeacher.List { Id = p.Id, OrgName = p.tbOrg.OrgName, TeacherName = p.tbTeacher.TeacherName, }).ToList(); } return(View(vm)); } }
public ActionResult List(Models.OrgTeacher.List vm) { return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText }))); }