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); } }
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(); } }