Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public Task <bool> UnbindResource(Guid roleId, Guid assetsId)
        {
            var result = RoleAssetsDb.Delete(ra => ra.RoleId == roleId & ra.AssetId == assetsId);

            return(Task.FromResult(result));
        }