public ActionResult List() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.ElectiveGroup.List(); vm.ElectiveName = db.Table <Entity.tbElective>().FirstOrDefault(d => d.Id == vm.ElectiveId).ElectiveName; var tb = from p in db.Table <Entity.tbElectiveGroup>() where p.tbElective.Id == vm.ElectiveId select p; if (string.IsNullOrEmpty(vm.SearchText) == false) { tb = tb.Where(d => d.ElectiveGroupName.Contains(vm.SearchText)); } vm.ElectiveGroupList = (from p in tb orderby p.No select p).ToList(); return(View(vm)); } }
public ActionResult List(Models.ElectiveGroup.List vm) { return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText, electiveId = vm.ElectiveId }))); }