Beispiel #1
0
        public async Task <int> DeleteRoleAsync(long roleId)
        {
            await ValidateId(_roleDao, roleId);

            if (await _userDao.IsAnyUserReferencingRoleAsync(roleId))
            {
                var entityReferenceException = new EntityReferenceException(roleId, "Role is not deletable");
                Logger.Error(entityReferenceException, "{Role} is not deletable", roleId);
                throw entityReferenceException;
            }

            return(await _roleDao.FluentSoftDeleteById(roleId));
        }