Advertisement
Guest User

Untitled

a guest
Dec 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. class LoginData : INotifyPropertyChanged
  2. {
  3. private string username, password;
  4.  
  5. public LoginData() { }
  6.  
  7. public LoginData(string username, string password)
  8. {
  9. Username = username;
  10. Password = password;
  11. }
  12.  
  13. ------------------------------------------------
  14.  
  15. public static async Task<bool> Login(LoginData logindata)
  16. {
  17. string json = JsonConvert.SerializeObject(logindata);
  18. var content = new StringContent(json, Encoding.UTF8, "application/json");
  19. HttpResponseMessage response = client.PostAsync(myRest + "/login" ,content).Result;
  20. if (response.IsSuccessStatusCode)
  21. {
  22. string result = await response.Content.ReadAsStringAsync();
  23. if (String.Compare(result, "OK") == 0)
  24. return true;
  25. }
  26. return false;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement