示例#1
0
        public static Task UpsertGroupAsync(this IUserManager userManager, Group group, Action <UpsertGroupOptions> configureOptions)
        {
            var options = new UpsertGroupOptions();

            configureOptions(options);

            return(userManager.UpsertGroupAsync(group, options));
        }
示例#2
0
        public async Task UpsertGroupAsync(Group group, UpsertGroupOptions options)
        {
            var uri = GetGroupsUri(group.Name);

            Logger.LogInformation($"Attempting to upsert group with name {group.Name} - {uri}");

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

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