예제 #1
0
        public Task <bool> UserHasRoleForDevice(int userId, UserAssetRole userAssetRole, int deviceId)
        {
            int roleId = (int)userAssetRole;

            return(repository.GetEntities <UserAssetEntity>().AnyAsync(x =>
                                                                       x.UserId == userId && x.Asset.Devices.Any(y => y.Id == deviceId) && x.RoleId == roleId));
        }
예제 #2
0
        public Task <bool> UserHasRoleForAsset(int userId, UserAssetRole userAssetRole, int assetId)
        {
            int roleId = (int)userAssetRole;

            return(repository.GetEntities <UserAssetEntity>().AnyAsync(x =>
                                                                       x.UserId == userId && x.AssetId == assetId && x.RoleId == roleId));
        }