Example #1
0
        public static Task UpsertUsersAsync(this IUserManager userManager, User user, Action <UpsertUserOptions> configureOptions)
        {
            var options = new UpsertUserOptions();

            configureOptions(options);

            return(userManager.UpsertUserAsync(user, options));
        }
Example #2
0
        public async Task UpsertUserAsync(User user, UpsertUserOptions options)
        {
            var uri = GetUsersUri(options.DomainName, user.Username);

            Logger.LogInformation($"Attempting to create user with username {user.Username} - {uri}");

            try
            {
                // upsert user
                var content = new FormUrlEncodedContent(GetUserFormValues(user));
                var result  = await _client.PutAsync(uri, content, options.CancellationToken).ConfigureAwait(false);

                result.EnsureSuccessStatusCode();
            }
            catch (Exception exception)
            {
                Logger.LogError(exception, $"Error trying to upsert user - {uri}");
                throw;
            }
        }