Exemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            this.taskADB = new TaskAssistantContext();
            var salt      = DataGenerator.GetRandStr(6, 6, true);
            var userModel = new UserModel()
            {
                Name     = firstNameBox.Text,
                Surname  = secondNameBox.Text,
                Username = UsernameBox.Text,
                Salt     = salt,
                Password = DataGenerator.GetSaltHash(PassBox.Password, salt),
            };

            var user = new User(userModel.Username, userModel.Name, userModel.Surname, userModel.Password, userModel.Salt);

            this.taskADB.Users.Add(user);
            this.taskADB.SaveChanges();

            SignIn signInPage = new SignIn();

            signInPage.Show();
            this.Close();
        }