public async Task<String> IssueAsync(SendRequest request) { String json = JsonConvert.SerializeObject(request); StringContent requestContent = new StringContent(json, Encoding.UTF8, "application/json"); String url = String.Format("{0}", _apiUrl); using (HttpResponseMessage responseMessage = await _httpClient.PostAsync(url, requestContent)) { if (responseMessage.IsSuccessStatusCode) { String responseContent = await responseMessage.Content.ReadAsStringAsync(); //Models.User.UpdateUserResponse response = JsonConvert.DeserializeObject<Models.User.UpdateUserResponse>(responseContent); return responseContent; } else { throw new InvalidOperationException(); } } }
public async Task <String> IssueAsync(SendRequest request) { String json = JsonConvert.SerializeObject(request); StringContent requestContent = new StringContent(json, Encoding.UTF8, "application/json"); String url = String.Format("{0}", _apiUrl); using (HttpResponseMessage responseMessage = await _httpClient.PostAsync(url, requestContent)) { if (responseMessage.IsSuccessStatusCode) { String responseContent = await responseMessage.Content.ReadAsStringAsync(); //Models.User.UpdateUserResponse response = JsonConvert.DeserializeObject<Models.User.UpdateUserResponse>(responseContent); return(responseContent); } else { throw new InvalidOperationException(); } } }