public async Task <bool> Confirm(ConfirmAdvertRequest model) { var advertModel = mapper.Map <ConfirmAdvertModel>(model); var jsonModel = JsonConvert.SerializeObject(advertModel); var response = await client.PutAsync(new Uri($"{client.BaseAddress}/confirm"), new StringContent(jsonModel)).ConfigureAwait(false); return(response.StatusCode == System.Net.HttpStatusCode.OK); }
public async Task <bool> Confirm(ConfirmAdvertRequest model) { var advertModel = _mapper.Map <ConfirmAdvertModel>(model); var jsonModel = JsonConvert.SerializeObject(advertModel); var response = await _httpClient.PutAsync(_httpClient.BaseAddress + "Advert/Confirm", new StringContent(jsonModel)); return(response.StatusCode == System.Net.HttpStatusCode.OK); }
public async Task <bool> Confirm(ConfirmAdvertRequest model) { var advertModel = _mapper.Map <ConfirmAdvertModel>(model); var jsonModel = JsonSerializer.Serialize(advertModel); var response = await _client.PutAsync(new Uri($"{_client.BaseAddress}/confirm"), new StringContent(jsonModel)); return(response.StatusCode == HttpStatusCode.OK); }
public async Task <bool> ConfirmAsync(ConfirmAdvertRequest model) { var advertModel = _mapper.Map <ConfirmAdvertModel>(model); var jsonModel = JsonConvert.SerializeObject(advertModel); var response = await _client.PutAsync(new Uri($"{_client.BaseAddress}/confirm"), new StringContent(jsonModel, Encoding.UTF8, "application/json")); return(response.StatusCode == HttpStatusCode.OK); }
public async Task<bool> Confirm(ConfirmAdvertRequest model) { ConfirmAdvertModel advertModel = _mapper.Map<ConfirmAdvertModel>(model); string jsonModel = JsonConvert.SerializeObject(advertModel); HttpResponseMessage response = await _client.PutAsync( new Uri($"{_baseAddress}/confirm"), new StringContent(jsonModel, Encoding.UTF8, "application/json") ); Console.WriteLine(response); return response.StatusCode == HttpStatusCode.OK; }
// 26 public async Task <bool> Confirm(ConfirmAdvertRequest model) { var advertModel = _mapper.Map <ConfirmAdvertModel>(model); //convert website model to Api Model var jsonModel = JsonConvert.SerializeObject(advertModel); //var response = await _client.PutAsync(new Uri($"{_client.BaseAddress}/confirm"), new StringContent(jsonModel)) // .ConfigureAwait(false); var response = await _client .PutAsync(new Uri($"{_baseAddress}/confirm"), new StringContent(jsonModel, Encoding.UTF8, "application/json")) .ConfigureAwait(false); return(response.StatusCode == System.Net.HttpStatusCode.OK); }