private void login_Click(object sender, RoutedEventArgs e) { User logUser = null; using (BookLibContext db = new BookLibContext()) { logUser = db.Users.Where(b => b.Login == loginTextBox.Text && b.Password == passwordTextBox.Text).FirstOrDefault(); } if (logUser != null) { MessageBox.Show("Login was successful"); } //перехід на головну сторінку }