public static void Initialize()
 {
     using (var db = new AanwezigheidslijstDbContext()) // gebruik in app - app.xaml.cs om database te linken
     {
         db.Database.Migrate();
     }
 }
 public void Delete(int id)
 {
     using (var ctx = new AanwezigheidslijstDbContext())
     {
         var doc = new Docent()
         {
             Id = id
         };
         ctx.Attach(doc);
         ctx.Remove(doc);
         ctx.SaveChanges();
     }
 }
 public List <ViewDocent> Read()
 {
     using (var ctx = new AanwezigheidslijstDbContext())
     {
         return(ctx.Docenten.Select(
                    d => new ViewDocent()
         {
             Id = d.Id,
             Naam = d.Naam,
             Bedrijf = d.Bedrijf
         }).ToList());
     }
 }
        public void Create(CreateDocent docent)
        {
            using (var ctx = new AanwezigheidslijstDbContext())
            {
                ctx.Add(new Docent()
                {
                    Bedrijf = docent.Bedrijf,
                    Naam    = docent.Naam
                });

                ctx.SaveChanges();
            }
        }