Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class LoginData : INotifyPropertyChanged
- {
- private string username, password;
- public LoginData() { }
- public LoginData(string username, string password)
- {
- Username = username;
- Password = password;
- }
- ------------------------------------------------
- public static async Task<bool> Login(LoginData logindata)
- {
- string json = JsonConvert.SerializeObject(logindata);
- var content = new StringContent(json, Encoding.UTF8, "application/json");
- HttpResponseMessage response = client.PostAsync(myRest + "/login" ,content).Result;
- if (response.IsSuccessStatusCode)
- {
- string result = await response.Content.ReadAsStringAsync();
- if (String.Compare(result, "OK") == 0)
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement