//获取拥有的权限 private List <ActionModel> GetAction(Employee user) { IEmployeeMenuActionService iMenuActionService = DIFactory.GetContainer().Resolve <IEmployeeMenuActionService>(); List <EmployeeMenuAction> menuActionlist = new List <EmployeeMenuAction>(); List <ActionModel> actionList = new List <ActionModel>(); if (user.IsAdmin == 0) { menuActionlist = iMenuActionService.Gets(t => user.MenuActionList.Contains(t.ID)).ToList(); } else { menuActionlist = iMenuActionService.Gets().ToList(); } foreach (var m in menuActionlist) { actionList.Add(new ActionModel() { Controller = m.EmployeeMenu.Controller.ToLower(), Action = m.Code.ToLower(), }); } return(actionList); }
public UpController(IEmployeeMenuService iEmployeeMenuService, IEmployeeMenuActionService iEmployeeMenuActionService, DbContext dbContext) { this.iEmployeeMenuService = iEmployeeMenuService; this.iEmployeeMenuActionService = iEmployeeMenuActionService; this.dbContext = dbContext; }