public ActionResult List() { using (var db = new XkSystem.Models.DbContext()) { var vm = new Models.SysMenu.List(); var tb = from p in db.Table <Sys.Entity.tbSysMenu>() where p.tbProgram.Id == Code.Common.ProgramId //&& p.tbSysUserType.Id == vm.UserTypeId select p; if (string.IsNullOrEmpty(vm.SearchText) == false) { tb = tb.Where(d => d.MenuName.Contains(vm.SearchText)); } if (vm.ParentId == 0) { tb = tb.Where(d => d.tbMenuParent == null); } else { tb = tb.Where(d => d.tbMenuParent.Id == vm.ParentId); } vm.MenuList = (from p in tb orderby p.No select new Dto.SysMenu.List { Id = p.Id, No = p.No, IsDisable = p.IsDisable, IsShortcut = p.IsShortcut, MenuName = p.MenuName, MenuParentName = p.tbMenuParent.MenuName, Icon = p.Icon, MenuUrl = p.MenuUrl }).ToList(); return(View(vm)); } }
public ActionResult List(Models.SysMenu.List vm) { return(Code.MvcHelper.Post(null, Url.Action("List", new { parentId = vm.ParentId, searchText = vm.SearchText }))); }