using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace WindowedMyApp { /// /// Логика взаимодействия для RegWind.xaml /// public partial class RegWind : Window { public RegWind() { InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { using (ModelClass db = new ModelClass()) { int HashPasswrd = surnameText.Password.GetHashCode(); Klients klient = db.Klients .FirstOrDefault(x => x.Login == nameText.Text && x.Patronymic == PatronymText.Text && x.Password == HashPasswrd); if (klient == null) { Klients Newklient = new Klients() { Login = nameText.Text, Patronymic = PatronymText.Text, Password = HashPasswrd, ID_Group = 1}; db.Klients.Add(Newklient); db.SaveChanges(); MessageBox.Show("Вы успешно зарегестрировались"); MainWindow wind = new MainWindow(); wind.Show(); Close(); } else { MessageBox.Show("Такой пользователь уже существует"); } } } private void toLoginButton_Click(object sender, RoutedEventArgs e) { MainWindow wind = new MainWindow(); wind.Show(); Close(); } } }