Beispiel #1
0
        public void ForgetPassword(string email)
        {
            var newPassword = "******" + new Random(1000).Next();
            string Body = System.IO.File.ReadAllText(HostingEnvironment.MapPath("~/Template/ForgetMail.html"));
            Body = Body.Replace("{{SENHA}}", newPassword);

            using (_db = new ProvaNetEntities())
            {
                _db.Configuration.ProxyCreationEnabled = false;
                var user = _db.TblUser.FirstOrDefault(
                    x => x.Email.Equals(email));
                if (user != null)
                {
                    user.Senha = new Crypt().Password(newPassword);
                    _db.Entry(user).State = EntityState.Modified;
                    _db.SaveChanges();

                    new SendMailHelper().SendEmail(
                        new string[] { email },
                        new string[] { email },
                        "Solicitação de Senha",
                        Body,
                        true
                    );
                }
            }
        }
Beispiel #2
0
 public void Update(TblUser user)
 {
     using (_db = new ProvaNetEntities())
     {
         _db.Configuration.ProxyCreationEnabled = false;
         _db.Entry(user).State = EntityState.Modified;
         _db.SaveChanges();
     }
 }
Beispiel #3
0
 public void Remove(TblContato contato)
 {
     using (_db = new ProvaNetEntities())
     {
         _db.Configuration.ProxyCreationEnabled = false;
         _db.Entry(contato).State = EntityState.Deleted;
         _db.SaveChanges();
     }
 }