Ejemplo n.º 1
0
 private void AddDocentMain_Click(object sender, EventArgs e)
 {
     using (var addDocentForm = new AddDocent())
     {
         var dialogresult = addDocentForm.ShowDialog();
         if (DialogResult.OK == dialogresult)
         {
             using (AanwezigheidsContext ctx = new AanwezigheidsContext())
             {
                 ctx.Docenten.Add(new Docent()
                 {
                     Naam    = addDocentForm.Naam,
                     Bedrijf = addDocentForm.Bedrijf
                 });
                 ctx.SaveChanges();
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void AddStudentMain_Click(object sender, EventArgs e)
        {
            using (var addStudentForm = new AddStudentForm())

            {
                var dialogresult = addStudentForm.ShowDialog();
                if (DialogResult.OK == DialogResult)
                {
                        using (AanwezigheidsContext ctx = new AanwezigheidsContext())
                        {
                            ctx.Deelnemers.Add(new Deelnemer()
                            {
                                Naam = addStudentForm.naam,
                                Woonplaats = addStudentForm.Adres,
                            });
                            ctx.SaveChanges();
                        }
                    }
                }
            }