public ActionResult List() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.MoralOption.List(); var tb = (from p in db.Table <Moral.Entity.tbMoralOption>() where p.tbMoralItem.Id == vm.MoralItemId select p); if (!string.IsNullOrWhiteSpace(vm.SearchText)) { tb = tb.Where(p => p.MoralOptionName.Contains(vm.SearchText)); } vm.MoralOptionList = (from p in tb orderby p.No select new Dto.MoralOption.List() { Id = p.Id, No = p.No, MoralItemId = p.tbMoralItem.Id, MoralItemName = p.tbMoralItem.MoralItemName, MoralOptionName = p.MoralOptionName, MoralOptionValue = p.MoralOptionValue }).ToPageList(vm.Page); return(View(vm)); } }
public ActionResult List(Models.MoralOption.List vm) { return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText, pageIndex = vm.Page.PageIndex, pageSize = vm.Page.PageSize }))); }