Exemplo n.º 1
0
 private BaseActionReturnModel SaveChange()
 {
     try
     {
         int i = ctx.SaveChanges();
         return(BaseActionReturnModel.CreateSuccededResult("OK " + i + " changes in database", false, null, false));
     }
     catch (Exception exc)
     {
         return(BaseActionReturnModel.CreateException(exc, false));
     }
 }
 private void AcceptButtonClick(object sender, RoutedEventArgs e)
 {
     if (loginText.Text.Length > 0 && passwordText.Password.Length > 0)
     {
         using (var context = new SecurityDataContext())
         {
             string hashedPassword = SecurityApp.Services.CryptoService.HashPassword(passwordText.Password);
             context.Users.Add(new User()
             {
                 Login    = loginText.Text,
                 Password = hashedPassword
             });
             context.SaveChanges();
         }
         MessageBox.Show("Регистрация выполнена");
         this.DialogResult = true;
     }
     else
     {
         MessageBox.Show("Заполните все поля");
     }
 }
Exemplo n.º 3
0
 public void Save()
 {
     context.SaveChanges();
 }