示例#1
0
        public async Task <bool> Delete(long groupId)
        {
            using (var identityGroupService = new IdentityGroupService())
            {
                var group = identityGroupService.FindByIdAsync(groupId).Result;

                foreach (var user in group.Users)
                {
                    await RemoveUserFromGroup(user.Id, @group.Name);
                }

                var result = await identityGroupService.DeleteAsync(group);

                return(result.Succeeded);
            }
        }
示例#2
0
        public async Task <bool> Delete(long groupId)
        {
            var identityGroupService = new IdentityGroupService();

            try
            {
                var group  = identityGroupService.FindByIdAsync(groupId).Result;
                var result = await identityGroupService.DeleteAsync(group);

                return(result.Succeeded);
            }
            finally
            {
                identityGroupService.Dispose();
            }
        }