private void connect_bttn_Click(object sender, RoutedEventArgs e) { using (IstorieEntities context = new IstorieEntities()) { var query = (from c in context.Users where c.name == numeUtilizator.Text && c.pass == parolaUtilizator.Text select c).Count(); if (query > 0) { MeniuPrincipal form = new MeniuPrincipal(); this.Hide(); form.ShowDialog(); this.Close(); } else { MessageBox.Show("Nume de utilizator sau parola gresita."); } } }
private void connect_bttn_Click(object sender, RoutedEventArgs e) { using (IstorieEntities context = new IstorieEntities()) { var user = (from c in context.Users where c.name == numeUtilizator.Text && c.pass == parolaUtilizator.Password select c).FirstOrDefault(); if (user != null) { UserActual.user = (User)user; MeniuPrincipal form = new MeniuPrincipal(); this.Hide(); form.ShowDialog(); this.Close(); } else { MessageBox.Show("Nume de utilizator sau parola gresita."); } } }