private void buttonEdit_Click(object sender, EventArgs e)
        {
            int  index     = dataGridViewAllBooks.SelectedRows[0].Index;
            int  Id        = 0;
            bool converted = Int32.TryParse(dataGridViewAllBooks[0, index].Value.ToString(), out Id);

            if (converted == false)
            {
                return;
            }
            b = bd.Books.Find(Id);
            AddForm f = new AddForm(b);

            if (f.ShowDialog() == DialogResult.OK)
            {
                bd.SaveChanges();
                dataGridViewAllBooks.Update();
                dataGridViewAllBooks.Refresh();
                MessageBox.Show("Данные отредактированные!");
            }
            else
            {
                MessageBox.Show("Не удалось отредактировать данные!");
            }
        }
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            b = new Books();
            AddForm f = new AddForm(b);

            if (f.ShowDialog() == DialogResult.OK)
            {
                Books tmp = bd.Books.Where(x => x.Id_Theme == b.Id_Theme && x.Id_Author == b.Id_Author && x.Id_Publisher == b.Id_Publisher &&
                                           x.NameBook == b.NameBook && x.Pages == b.Pages && x.Year == b.Year && x.ProductPrice == b.ProductPrice).FirstOrDefault();
                if (tmp == null)
                {
                    bd.Books.Add(b);
                    bd.SaveChanges();
                }
            }
        }