public ActionResult List() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.Moral.List(); var tb = (from p in db.Table <Moral.Entity.tbMoral>() select p); if (!string.IsNullOrWhiteSpace(vm.SearchText)) { tb = tb.Where(p => p.MoralName.Contains(vm.SearchText)); } vm.MoralList = (from p in tb orderby p.No descending select new Dto.Moral.List() { Id = p.Id, FromDate = p.FromDate, ToDate = p.ToDate, MoralName = p.MoralName, IsOpen = p.IsOpen, MoralType = p.MoralType, YearName = p.tbYear.YearName }).ToPageList(vm.Page); return(View(vm)); } }
public ActionResult List(Models.Moral.List vm) { return(Code.MvcHelper.Post(null, Url.Action("List", new { SearchText = vm.SearchText, PageIndex = vm.Page.PageIndex, PageSize = vm.Page.PageSize }))); }