private bool ValidPurview(UserObj userObj, UserFunctionMenuItemDTO menuItem) { if (menuItem == null) { return(true); } else { string funcId = menuItem.ID.ToString(); return(userObj.PurviewFuncIDs.Contains(funcId)); } }
private UserFunctionMenuItemDTO GetCurrentMenuItem(ActionExecutingContext filterContext) { UserFunctionMenuItemDTO dto = null; string controller = filterContext.RouteData.Values["controller"] == null ? "" : filterContext.RouteData.Values["controller"].ToString().ToLower(); string action = filterContext.RouteData.Values["action"] == null ? "" : filterContext.RouteData.Values["action"].ToString().ToLower(); string area = filterContext.RouteData.DataTokens["area"] == null ? "" : filterContext.RouteData.DataTokens["area"].ToString().ToLower(); if (!string.IsNullOrWhiteSpace(controller) && !string.IsNullOrWhiteSpace(action)) { IUserFunctionService userFuncService = ContainerManager.Resolve <IUserFunctionService>(); var funcList = userFuncService.GetAllFuncitonMenuList(); dto = funcList.FirstOrDefault(m => m.AreaName.ToLower() == area && m.ControllerName.ToLower() == controller && m.ActionName.ToLower() == action); } return(dto); }