private void Button_Click(object sender, RoutedEventArgs e) { AddForm addForm = new AddForm(); if (addForm.ShowDialog() == true) { var author = new Author() { FirstName = addForm.FirstName, LastName = addForm.LastName }; InsertToDB(author); Update(); } }
private void Edit_Click(object sender, RoutedEventArgs e) { if (LV.SelectedIndex != -1) { var ut = (Author)LV.SelectedItem; AddForm addForm = new AddForm(); addForm.FirstName = ut.FirstName; addForm.LastName = ut.LastName; if (addForm.ShowDialog() == true) { UpdateAuthor(ut.Id, addForm.FirstName, addForm.LastName); ClickHandler(null, null); } } }