Esempio n. 1
0
 private void btnSignUp_Click(object sender, RoutedEventArgs e)
 {
     using (var context = new HrDBContext()) {
         var user = new User()
         {
             UserName   = txtUserName.Text,
             FirstName  = txtFN.Text,
             LastName   = txtLN.Text,
             Position   = txtPosition.Text,
             CreateDate = DateTime.Now,
             Email      = txtEmail.Text,
             Password   = PasswordCrypt.SimpleEncrypt(txtPW.Text)
         };
         context.Users.Add(user);
         context.SaveChanges();
     }
     closeFrm();
 }
 private void btnAddEmployee(object sender, RoutedEventArgs e)
 {
     using (var context = new HrDBContext()){
         var employee = new Employee()
         {
             FirstName = "test",
             LastName  = "test",
             HireDate  = DateTime.Now,
             Position  = "test",
             Email     = "test",
             PayRate   = 2.25,
             Picture   = bytePic
         };
         context.Configuration.AutoDetectChangesEnabled = false;
         context.Employees.Add(employee);
         context.SaveChanges();
     }
 }