Exemple #1
0
        private void DelLessonBut_Click(object sender, EventArgs e)
        {
            var c = dataGridView1.SelectedCells;

            int indrow;

            if (c.Count == 0)
            {
                return;
            }

            indrow = c[0].RowIndex;

            var s = dataGridView1.Rows[indrow];

            var dels = (int)s.Cells[0].Value;

            BD.SchoolEntities entities = new BD.SchoolEntities();

            BD.Lessons dt = entities.Lessons.Find(dels);

            entities.Lessons.Remove(dt);

            entities.SaveChanges();

            MessageBox.Show("Lesson delited!");
        }
Exemple #2
0
        private void AddLessonsBut_Click(object sender, EventArgs e)
        {
            BD.SchoolEntities entities = new BD.SchoolEntities();

            BD.Lessons lessons = new BD.Lessons();

            lessons.NameL = textBox1.Text;

            MessageBox.Show("Add lesson(does not work)");
        }