예제 #1
0
        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();
            }
        }
예제 #2
0
        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);
                }
            }
        }