protected override void Dispose(bool disposing) { if (disposing) { _dbContext.Dispose(); } base.Dispose(disposing); }
protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
protected virtual void Dispose(bool disposing) { if (!disposed && disposing) { _context.Dispose(); } disposed = true; }
public virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { _context.Dispose(); } this.disposed = true; } }
protected virtual void Dispose(bool disposing) { if (!_disposed) { if (disposing) { _dbContext.Dispose(); } } //dispose unmanaged resources _disposed = true; }
private void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { _context.Dispose(); } _disposed = true; }
protected void register_btn_Click(object sender, EventArgs e) { RegisterModel registerModel = new RegisterModel { Name = txbx_name.Value, Surname = txbx_surname.Value, Email = txbx_email.Value, Password = txbx_password.Value }; ValidationContext validationContext = new ValidationContext(registerModel); List <ValidationResult> validationResults = new List <ValidationResult>(); if (!Validator.TryValidateObject(registerModel, validationContext, validationResults)) { foreach (var result in validationResults) { ModelState.AddModelError(result.MemberNames.ToList()[1].ToString(), result.ErrorMessage); } } else { Person person = new Person { Name = registerModel.Name, Surname = registerModel.Surname, Email = registerModel.Email, Password = registerModel.Password, IsLocked = false, RegisterDate = DateTime.Now }; UserDbContext u = new UserDbContext(); u.People.Add(person); u.SaveChanges(); u.Dispose(); //try //{ // u.SaveChanges(); //} //catch (DbEntityValidationException message) //{ // Console.WriteLine(message); //} Response.Redirect("Login.aspx"); } }
protected void login_btn_Click(object sender, EventArgs e) { LoginModel loginModel = new LoginModel { Email = txbx_email.Value, Password = txbx_password.Value }; ValidationContext validationContext = new ValidationContext(loginModel); List <ValidationResult> validationResults = new List <ValidationResult>(); if (!Validator.TryValidateObject(loginModel, validationContext, validationResults)) { foreach (var result in validationResults) { ModelState.AddModelError(result.MemberNames.ToList()[1].ToString(), result.ErrorMessage); } } else { Person person = new Person(); UserDbContext u = new UserDbContext(); person = u.People.Where(p => p.Email == loginModel.Email && p.Password == loginModel.Password).FirstOrDefault(); u.Dispose(); if (person?.IsLocked == false) { Response.Redirect("~/UsersList.aspx"); } else if (person?.IsLocked == true) { ModelState.AddModelError("", "Admin is locked you!"); } else { ModelState.AddModelError("", "Email or Password is not valid"); } } }
public void Dispose() { dbContext.Dispose(); }
public void Dispose() { UserDbContext?.Dispose(); UserManager?.Dispose(); RoleManager?.Dispose(); }
public void Dispose() { _appDb?.Dispose(); _userDb?.Dispose(); _connection?.Close(); }
public void Dispose() { _context.Dispose(); }
public void Dispose() { dataContext.Dispose(); }
public void TearDown() { _context.Database.EnsureDeleted(); _context.Dispose(); }