public bool IsUserHasPermissions(long permissionId, string userName) { var user = _userRepository.GetUserBy(userName.ToLower()); var userRoles = user.UserRoles; var roles = userRoles.Select(r => r.RoleId).ToList(); foreach (var roleId in roles) { if (_roleApplication.IsRoleHasThePermission(roleId, permissionId)) { return(true); } } return(false); }