public ActionResult ConfirmaTroca()
        {
            var conf = Session["trocaSMTP"] as UpdateSmtpViewModel;

            if (conf != null)
            {
                var cryptograph = new AESEncription();
                ViewBag.novoemail = conf.SmtpUsername;
                var config = _serverConfigRepo.GetAllConfig();
                config.SmtpAdress   = conf.SmtpAdress;
                config.SmtpPort     = conf.SmtpPort;
                config.SmtpUsername = conf.SmtpUsername;
                config.SmtpPassword = cryptograph.EncryptMensage(conf.SmtpPassword);
                _serverConfigRepo.Update(config);
                Session.Remove("trocaSMTP");
            }
            return(View());
        }
 public MyJsonResult ResetSMTP()
 {
     try
     {
         var config      = _serverConfigRepo.GetAllConfig();
         var cryptograph = new AESEncription();
         config.SmtpAdress   = "smtp.mail.yahoo.com";
         config.SmtpPort     = 587;
         config.SmtpUsername = "******";
         config.SmtpPassword = cryptograph.EncryptMensage("epncrejjztlleysk");
         _serverConfigRepo.Update(config);
         return(new MyJsonResult(true, JsonRequestBehavior.DenyGet));
     }
     catch
     {
         Response.TrySkipIisCustomErrors = true;
         Response.StatusCode             = 500;
         return(new MyJsonResult(false, JsonRequestBehavior.DenyGet));
     }
 }