Ejemplo n.º 1
0
        public ActionResult Create(Comment model)
        {
            if (ModelState.IsValid)
            {
                _db.Comments.Add(model);
                _db.SaveChanges();
                BackgroundJob.Enqueue(() => NotifyNewComment(model.Id));
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult Create(Comment model)
        {
            if (ModelState.IsValid)
            {
                _db.Comments.Add(model);
                _db.SaveChanges();

                Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("es-ES");
                BackgroundJob.Enqueue(() => NotifyNewComment(model.Id));
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        protected Storage.Entities.Mail SetupMail(MailStatus status = MailStatus.Pending)
        {
            // TODO move to factory
            var mailRecord = new Storage.Entities.Mail
            {
                Sender     = Faker.Internet.Email(),
                Recipients = new[] { Faker.Internet.Email(), Faker.Internet.Email() },
                Subject    = Faker.Company.Name(),
                Body       = Faker.Lorem.Paragraph(),
                Priority   = MailPriority.Normal,
                Status     = status
            };

            DbContext.Mails.Add(mailRecord);
            DbContext.SaveChanges();
            return(mailRecord);
        }
Ejemplo n.º 4
0
        public ActionResult Index(ConfirmationEmailViewModel model)
        {
            if (model != null)
            {
                using (MailerDbContext db = new MailerDbContext())
                {
                    model.Id         = Guid.NewGuid();
                    model.QRCodePath = CreateQRCodeImage(model.Id.ToString());
                    db.ConfirmationEmails.Add(model);
                    db.SaveChanges();
                }

                BackgroundJob.Enqueue(() => SendConfirmationEmail(model.Id));
            }

            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult Create(Comment model)
        {
            if (ModelState.IsValid)
            {
                _db.Comments.Add(model);
                _db.SaveChanges();

                var email = new NewCommentEmail
                {
                    To       = "*****@*****.**",
                    UserName = model.UserName,
                    Comment  = model.Text
                };

                email.Send();
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 6
0
        public ActionResult Create(Comment model)
        {
            if (ModelState.IsValid)
            {
                _db.Comments.Add(model);
                _db.SaveChanges();

                //var email = new NewCommentEmail
                //{
                //    To = "*****@*****.**",
                //    UserName = model.UserName,
                //    Comment = model.Text
                //};

                //email.Send();
            }

            BackgroundJob.Enqueue(() => NotifyNewComment(model.Id));
            return(RedirectToAction("Index"));
        }