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("Заполните все поля"); } }
public void Save() { context.SaveChanges(); }