private void BackWard(object sender, RoutedEventArgs e) { BooksWindow bw = new BooksWindow(); bw.Show(); this.Close(); }
private void Books(object sender, RoutedEventArgs e) { BooksWindow mw = new BooksWindow(); mw.Show(); this.Close(); }
private void Adding(object sender, RoutedEventArgs e) { if (BookTitle.Text == "" || Edition.Text == "" || ReleaseDate.Text == "" || CostPrice.Text == "" || IDAuthor.SelectedValue.ToString() == "") { MessageBox.Show("Возникла ошибка! Возможно вы не заполнили поля"); return; } else { Books books = new Books(); books.BookTitle = BookTitle.Text; books.Edition = Edition.Text; books.ReleaseDate = Convert.ToDateTime(ReleaseDate.Text); books.CostPrice = Convert.ToInt32(CostPrice.Text); books.IDAuthor = Convert.ToInt32(IDAuthor.SelectedValue.ToString()); db.Books.Add(books); db.SaveChanges(); MessageBox.Show("Добавлена книга"); BooksWindow bw = new BooksWindow(); bw.Show(); this.Close(); } }