Exemplo n.º 1
0
 /// <summary>
 /// check if all info was correct and send mail to the email
 /// </summary>
 /// <param name="email"></param>
 /// <param name="favColor"></param>
 public void CheckUserinfo(string email, string favColor)
 {
     try
     {
         //if email and favcolor is correct
         if (Validdate(email, favColor))
         {
             string key = GenerateKey();
             //check email for existing;;
             var keymodel = KeyRepository.CheckKeyExistByEmail(email);
             if (keymodel != null)
             {
                 keymodel.Key = key;
                 keyService.UpdateKey(keymodel);
             }
             else
             {
                 keyService.SetKey(key, email);
             }
             //send mail to the given email
             EmailController emailController = new EmailController();
             emailController.SendMail("ResetKey", email, "Your reset key is: " + key);
             MessageBox.Show("Email send");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }