public async Task <bool> BindResource(RoleAssets roleAccess) { var validteReuslt = RoleAssets.Validate(roleAccess); if (validteReuslt.All(x => x.IsSuccess) && RoleAssetsDb.GetSingle(ra => ra.RoleId == roleAccess.RoleId && ra.AssetId == roleAccess.AssetId).IsNull() ) { var effectCount = await RoleAssetsDb.AsInsertable(roleAccess).ExecuteCommandAsync(); return(effectCount > 0); } return(false); }
public Task <bool> UnbindResource(Guid roleId, Guid assetsId) { var result = RoleAssetsDb.Delete(ra => ra.RoleId == roleId & ra.AssetId == assetsId); return(Task.FromResult(result)); }