Advertisement
Guest User

Untitled

a guest
Oct 7th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. HttpClient httpClient = new HttpClient();
  2. var jsonReponse = await httpClient.GetStringAsync("http://localhost:xxxxx/api/LogIns");
  3. logInResult = JsonConvert.DeserializeObject<List<LogIn>>(jsonReponse);
  4.  
  5. var logIn = new Models.LogIn()
  6. {
  7. Username = "username",
  8. Password = "password"
  9. };
  10. var logInJson = JsonConvert.SerializeObject(logIn);
  11.  
  12. HttpClient httpClient = new HttpClient();
  13. var httpContent = new StringContent(logInJson);
  14. httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
  15.  
  16. await httpClient.PostAsync("http://localhost:56267/api/LogIns", httpContent);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement