private void changeButton_Click(object sender, RoutedEventArgs e) { MessageBox.Show(CheckData()); //if var profile = new users { login = loginTextBox.Text, password = passwordTextBox.Password, email = emailTextBox.Text, full_name = fullNameTextBox.Text }; context.users.Add(profile); context.SaveChanges(); UsersWindow usersWin = new UsersWindow(profile); usersWin.Show(); this.Close(); }
public void CheckData() { var check = usersEntities.users.FirstOrDefault(x => x.login == loginTextBox.Text && x.password == passwordTextBox.Password); if (check == null) { MessageBox.Show("Неверно введен логин или пароль"); } else { UsersWindow usersWindow = new UsersWindow(check); usersWindow.Show(); this.Close(); } }
private void changeButton_Click(object sender, RoutedEventArgs e) { if (CheckData()) { users _newuserdata = new users(); _newuserdata = context.users.FirstOrDefault(x => x.id == _podopini.id); _newuserdata.full_name = fullNameTextBox.Text; _newuserdata.password = passwordTextBox.Password; _newuserdata.email = emailTextBox.Text; _newuserdata.login = loginTextBox.Text; _newuserdata.last_change = DateTime.UtcNow; _podopini = _newuserdata; context.SaveChanges(); UsersWindow usersWin = new UsersWindow(_podopini); usersWin.Show(); this.Close(); } }