public async Task <bool> ExecuteAsync( UpdateSettingParameter parameter, string settingUrl, string authorizationHeaderValue) { if (parameter == null) { throw new ArgumentNullException(nameof(parameter)); } Uri uri = null; if (!Uri.TryCreate(settingUrl, UriKind.Absolute, out uri)) { throw new ArgumentException("the uri is not correct"); } var httpClient = _httpClientFactory.GetHttpClient(); var request = new HttpRequestMessage { Method = HttpMethod.Put, RequestUri = uri, Content = new StringContent(JsonConvert.SerializeObject(parameter), Encoding.UTF8, "application/json") }; request.Headers.Add("Authorization", "Bearer " + authorizationHeaderValue); var httpResult = await httpClient.SendAsync(request).ConfigureAwait(false); httpResult.EnsureSuccessStatusCode(); return(true); }
public Task <bool> Execute(UpdateSettingParameter updateSettingParameter) { if (updateSettingParameter == null) { throw new ArgumentNullException(nameof(updateSettingParameter)); } if (string.IsNullOrWhiteSpace(updateSettingParameter.Key)) { throw new ArgumentNullException(nameof(updateSettingParameter.Key)); } return(_settingRepository.Update(new Models.Setting { Key = updateSettingParameter.Key, Value = updateSettingParameter.Value })); }
public Task <bool> UpdateSetting(UpdateSettingParameter updateSettingParameter) { return(_updateSettingAction.Execute(updateSettingParameter)); }
public async Task <bool> UpdateSettingByResolving(UpdateSettingParameter parameter, string configurationUrl, string accessToken) { var url = await GetSettingUrl(configurationUrl); return(await UpdateSetting(parameter, url, accessToken)); }
public async Task <bool> UpdateSetting(UpdateSettingParameter parameter, string settingUrl, string accessToken) { return(await _updateSettingOperation.ExecuteAsync(parameter, settingUrl, accessToken)); }