public void updateListBoxUsers() { using (ProjectBEntities ctx = new ProjectBEntities()) { var personeelsQuery = ctx.Personeelslid.Select(p => p).ToList(); lbUsers.ItemsSource = personeelsQuery; } }
private void btnLogin_Click(object sender, RoutedEventArgs e) { string pass = ComputeHash(pwbPass.Password); string username = tbUsername.Text; using (ProjectBEntities ctx = new ProjectBEntities()) { var pwtest = ctx.Personeelslid.Where(p => p.Username == tbUsername.Text && p.Pass == pass).Count(); if (pwtest == 1) { Personeelslid ingelogdPersoneelslid = ctx.Personeelslid.Where(p => p.Username == username).FirstOrDefault(); Hoofdmenu hoofdmenu = new Hoofdmenu(ingelogdPersoneelslid); hoofdmenu.Show(); this.Close(); } else { MessageBox.Show("Gebruikersnaam of wachtwoord verkeerd!"); } } }