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