public ActionResult List() { if (Code.Common.UserType != Code.EnumHelper.SysUserType.Administrator && Code.Common.UserType != Code.EnumHelper.SysUserType.Teacher) { return(Content(Code.Common.Redirect(Url.Action("Index", "SysIndex", new { area = "Sys" }), "当前身份类别无法访问该功能!"))); } using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.Elective.List(); var tb = from p in db.Table <Entity.tbElective>() select p; if (string.IsNullOrEmpty(vm.SearchText) == false) { tb = tb.Where(d => d.ElectiveName.Contains(vm.SearchText)); } vm.ElectiveList = (from p in tb orderby p.No descending select new Dto.Elective.List { Id = p.Id, No = p.No, ElectiveName = p.ElectiveName, ElectiveTypeName = p.tbElectiveType.ElectiveTypeName, IsPop = p.IsPop, FromDate = p.FromDate, IsDisable = p.IsDisable, Remark = p.Remark, ToDate = p.ToDate }).ToPageList(vm.Page); return(View(vm)); } }
public ActionResult List(Models.Elective.List vm) { return(Code.MvcHelper.Post(null, Url.Action("List", new { searchText = vm.SearchText, pageIndex = vm.Page.PageIndex, pageSize = vm.Page.PageSize }))); }