//protected override void OnAppearing() //{ // base.OnAppearing(); // //List<Note> notes = await App.GetDatabase.GetNotesAsync(); // //listView.ItemsSource = notes.OrderBy(d => d.Date).ToList(); //} async void OnLogin(object sender, EventArgs e) { Dans dan = await new DansWebService().Login("*****@*****.**", "123"); if (dan == null) { fail.Text = "Email hoac mat khau khong dung!"; } else { Application.Current.Properties["userId"] = dan.ma_dan; Application.Current.MainPage = new NavigationPage(new Home()); } }
public async Task <Dans> GetDanById(int id) { Dans dan = new Dans(); try { var client = new HttpClient(); var response = await client.GetAsync(uri + "/" + id); var content = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject <Dans>(content); return(result); } catch (Exception ex) { Debug.WriteLine("\tERROR {0} alo alo bug", ex.Message); } return(dan); }
public async Task <Dans> Login(string email, string password) { Dans dan = new Dans(); try { var client = new HttpClient(); var response = await client.GetAsync(uri + "?email=" + email + "&password="******"\tERROR {0} alo alo bug", ex.Message); } return(dan); }
async void getDanById() { Dans dan = await new DansWebService().GetDanById(Int16.Parse(Application.Current.Properties["userId"].ToString())); userName.Text = "Welcome, " + dan.ho_ten; }