Esempio n. 1
0
        public ActionResult Save(int? id, MailConfiguration input)
        {
            MailConfiguration conf;
            if ( !id.HasValue )
            {
                conf = new MailConfiguration();
                DocumentSession.Store(conf);
            } else
            {
                conf = DocumentSession.Load<MailConfiguration>(id);
            }

            conf.Name = input.Name;
            conf.From = input.From;
            conf.Recipients =
                (input.Recipients != null)
                    ? input.Recipients[0].Split(',').ToList()
                    : new List<string>() { String.Empty };
            conf.SmtpEnableSsl = input.SmtpEnableSsl;
            conf.SmtpHost = input.SmtpHost;
            conf.SmtpPassword = input.SmtpPassword;
            conf.SmtpUser = input.SmtpUser;
            conf.SmtpPort = input.SmtpPort;

            conf.Recipients.ForEach(x => x = x.Trim());

            DocumentSession.SaveChanges();

            TempData["Message"] = "Configuração salva!";

            return RedirectToAction("Index");
        }
Esempio n. 2
0
        public ActionResult Details(int? id)
        {
            var conf = new MailConfiguration();
            if ( id.HasValue )
            {
                conf = DocumentSession.Load<MailConfiguration>(id);

                if (conf == null)
                {
                    return HttpNotFound();
                }
            }

            conf.Recipients = new List<string>() { string.Join(",", conf.Recipients) };

            return View(conf);
        }
Esempio n. 3
0
 public SendEmailTask(MailConfiguration conf, MailRequest request)
 {
     this.MailRequest = request;
     this.MailConfiguration = conf;
 }