public async Task <IActionResult> Test(string firstName) { var newModel = new UserLoginModel() { firstName = firstName }; var content = new StringContent(JsonConvert.SerializeObject(newModel), Encoding.UTF8, "application/json"); var url = "User/Test"; var post = await HttpClientAdapter.Post(BaseUri + url, content); var data = await HttpClientAdapter.GetAsync <UserLoginModel>(BaseUri + "User"); return(Content($"Hello {data.firstName}")); }
private void Button_Click(object sender, RoutedEventArgs e) { HttpButton.IsEnabled = false; try { using (var client = new HttpClientAdapter()) using (var response = client.GetAsync("https://www.thinktecture.com").GetAwaiter().GetResult()) { Output.Text += $"HTTP GET https://www.thinktecture.com returned {response.StatusCode}"; } } finally { HttpButton.IsEnabled = true; } }