private void UpdateCountSent(EmailList model)
 {
     model.countsent += 1;
     using (EmailDBContext context = new EmailDBContext())
     {
         context.EmailList.Update(model);
         context.SaveChanges();
     }
 }
 public List <EmailList> GetAllEmails()
 {
     using (EmailDBContext context = new EmailDBContext())
     {
         var newList = new List <EmailList>();
         var list    = context.EmailList;
         foreach (var item in list)
         {
             newList.Add(new EmailList()
             {
                 Id            = item.Id,
                 email         = item.email,
                 emailverified = item.emailverified,
                 countsent     = item.countsent,
                 replysent     = item.replysent
             });
         }
         return(newList);
     }
 }
Beispiel #3
0
        private void SetVerifyEmail(Guid id)
        {
            using (EmailDBContext context = new EmailDBContext())
            {
                var eList = new EmailSend().GetAllEmails()
                            .Where(x => x.Id == id && x.emailverified == false).FirstOrDefault();
                if (eList != null)
                {
                    eList.emailverified = true;

                    MailMessage message  = new MailMessage("*****@*****.**", eList.email);
                    string      mailbody = "Thank you for verifying the email";
                    message.Subject      = "Thank you Email";
                    message.Body         = mailbody;
                    message.BodyEncoding = Encoding.UTF8;
                    message.IsBodyHtml   = true;
                    EmailHelper eh = new EmailHelper();
                    eh.SendEmail(message);
                    eList.replysent = true;
                    context.Update(eList);
                    context.SaveChanges();
                }
            }
        }