private void btnDell_Click(object sender, EventArgs e) { try { if (lectures.id >= 0) { using (ZoraModel db = new ZoraModel()) { lectures = db.Lectures.Find(lectures.id); db.Lectures.Remove(lectures); db.SaveChanges(); LoadingDef(); MessageBox.Show("Операция завершена успешно"); } } else { MessageBox.Show("Выберите объект из таблицы"); } } catch (Exception) { MessageBox.Show("Выберите объект из таблицы"); } }
private void button1_Click(object sender, EventArgs e) { if (lectures.id >= 0) { using (ZoraModel db = new ZoraModel()) { lectures = db.Lectures.Find(lectures.id); AddValue(); db.SaveChanges(); LoadingDef(); MessageBox.Show("Операция завершена успешно"); } } else { MessageBox.Show("Выберите объект из таблицы"); } }
private void btnAdd_Click(object sender, EventArgs e) { try { lectures = new Lectures(); AddValue(); using (ZoraModel db = new ZoraModel()) { db.Lectures.Add(lectures); db.SaveChanges(); LoadingDef(); MessageBox.Show("Операция завершена успешно"); } } catch (Exception) { MessageBox.Show("Error: Date error format"); } }