コード例 #1
0
        public virtual async Task DeleteAsync(Guid id)
        {
            var children = await FindChildrenAsync(id, true);

            foreach (var child in children)
            {
                await OrganizationUnitRepository.RemoveAllMembersAsync(child);

                await OrganizationUnitRepository.RemoveAllRolesAsync(child);

                await OrganizationUnitRepository.DeleteAsync(child);
            }

            var organizationUnit = await OrganizationUnitRepository.GetAsync(id);

            await OrganizationUnitRepository.RemoveAllMembersAsync(organizationUnit);

            await OrganizationUnitRepository.RemoveAllRolesAsync(organizationUnit);

            await OrganizationUnitRepository.DeleteAsync(id);
        }