/// <summary> /// Delete a user /// </summary> /// <param name="user"/> /// <returns/> public Task DeleteAsync(BackOfficeIdentityUser user) { ThrowIfDisposed(); if (user == null) { throw new ArgumentNullException(nameof(user)); } var asInt = user.Id.TryConvertTo <int>(); if (asInt == false) { throw new InvalidOperationException("The user id must be an integer to work with the Umbraco"); } var found = _userService.GetUserById(asInt.Result); if (found != null) { _userService.Delete(found); } _externalLoginService.DeleteUserLogins(asInt.Result); return(Task.FromResult(0)); }
/// <inheritdoc /> public override Task <IdentityResult> DeleteAsync(BackOfficeIdentityUser user, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); if (user == null) { throw new ArgumentNullException(nameof(user)); } IUser found = _userService.GetUserById(UserIdToInt(user.Id)); if (found != null) { _userService.Delete(found); } _externalLoginService.DeleteUserLogins(UserIdToInt(user.Id)); return(Task.FromResult(IdentityResult.Success)); }