private void OWNER_DG_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (OWNER_DG.SelectedItem != null) { selectOwner = (VetService.ClassLibary.Owner)OWNER_DG.SelectedItem; txtSurname.Text = selectOwner.Surname; txtGivenName.Text = selectOwner.GivenName; txtPhone.Text = selectOwner.Phone; Create_BTN.IsEnabled = false; } }
private async void Update_BTN_Click(object sender, RoutedEventArgs e) { client = new APIClient(); VetService.ClassLibary.Owner updateOwner = new VetService.ClassLibary.Owner() { OwnerID = selectOwner.OwnerID, Surname = txtSurname.Text, GivenName = txtGivenName.Text, Phone = txtPhone.Text }; await client.UpdateOwner(updateOwner); owners = await client.GetOwners(); OWNER_DG.ItemsSource = owners; }
private async void Create_BTN_Click(object sender, RoutedEventArgs e) { client = new APIClient(); VetService.ClassLibary.Owner newOwner = new VetService.ClassLibary.Owner() { OwnerID = await client.NextOwnerID(), Surname = txtSurname.Text, GivenName = txtGivenName.Text, Phone = txtPhone.Text }; await client.CreateOwner(newOwner); owners = await client.GetOwners(); OWNER_DG.ItemsSource = owners; //OWNER_DG.ItemsSource = newOwner.ToString(); }