public ActionResult List(Models.DormOption.List vm) { return(Code.MvcHelper.Post(null, Url.Action("List", new { SearchText = vm.SearchText, pageIndex = vm.Page.PageIndex, pageSize = vm.Page.PageSize }))); }
public ActionResult List() { var vm = new Models.DormOption.List(); using (var db = new XkSystem.Models.DbContext()) { var tb = db.Table <Dorm.Entity.tbDormOption>(); if (!string.IsNullOrEmpty(vm.SearchText)) { tb = tb.Where(d => d.DormOptionName.Contains(vm.SearchText)); } vm.DormOptionList = (from p in tb orderby p.No select p).ToPageList(vm.Page); } return(View(vm)); }