예제 #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtUsername.Text) && !String.IsNullOrEmpty(txtPassword.Text) && !String.IsNullOrEmpty(txtRePassword.Text))
            {
                if (txtPassword.Text != txtRePassword.Text)
                {
                    MessageBox.Show("Die Passwörter stimmen nicht überein!");
                    return;
                }

                using (CarSharingDBEntitiesNew context = new CarSharingDBEntitiesNew())
                {
                    User User1 = new User()
                    {
                        Username = txtUsername.Text,
                        Password = HashHelper.ComputeHash(txtPassword.Text, "SHA512", null)
                    };
                    context.User.Add(User1);
                    context.SaveChanges();
                    MessageBox.Show("Deine Daten wurden erfolgreich gespeichert!");
                }
            }
            else
            {
                MessageBox.Show("Bitte fülle alle Felder aus!");
            }
        }
예제 #2
0
 private void FarbeBearbeiten_FormClosing(object sender, FormClosingEventArgs e)
 {
     _context.SaveChanges();
 }