public ActionResult List() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.ElectiveOrgStudent.List(); vm.ElectiveOrgName = db.Set <Entity.tbElectiveOrg>().Find(vm.ElectiveOrgId).OrgName; var tb = from p in db.Table <Entity.tbElectiveOrgStudent>() where p.tbElectiveOrg.Id == vm.ElectiveOrgId && p.IsDeleted == false select p; if (string.IsNullOrEmpty(vm.SearchText) == false) { tb = tb.Where(d => d.tbStudent.StudentCode.Contains(vm.SearchText) || d.tbStudent.StudentName.Contains(vm.SearchText)); } vm.ElectiveOrgStudentList = (from p in tb orderby p.tbElectiveOrg.OrgName select new Dto.ElectiveOrgStudent.List { Id = p.Id, ElectiveOrgName = p.tbElectiveOrg.OrgName, StudentCode = p.tbStudent.StudentCode, StudentName = p.tbStudent.StudentName, IsFixed = p.IsFixed, IsChecked = p.IsChecked }).ToList(); return(View(vm)); } }
public ActionResult List(Models.ElectiveOrgStudent.List vm) { return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText, electiveId = vm.ElectiveId, electiveOrgId = vm.ElectiveOrgId }))); }