protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
/* public static async Task PasswordRecovery(string email) * { * var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(usuarioContext)); * var userASP = userManager.FindByEmail(email); * if (userASP == null) * { * return; * } * * var user = db.Usuarios.Where(tp => tp.UserName == email).FirstOrDefault(); * if (user == null) * { * return; * } * * var random = new Random(); * var newPassword = string.Format("{0}{1}{2:04}*", * user.Nombre.ToUpper().Substring(0, 1), * user.Apellido.ToLower(), random.Next(9999)); * * userManager.RemovePassword(userASP.Id); * userManager.AddPassword(userASP.Id, newPassword); * * var subject = "Recuperar Contraseña"; * var body = string.Format(@" * <h1>Resetear su contraseña</h1> * <p>Su nueva contraseña es <strong>{0}</strong></p> * <p>Por favor cambiela por una nueva</p>", newPassword); * await MailHelper.SendMail(email, subject, body); * } */ public void Dispose() { usuarioContext.Dispose(); db.Dispose(); }
public void Dispose() { db.Dispose(); }