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)); }
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)); }