public ActionResult Create(Comment model) { if (ModelState.IsValid) { _db.Comments.Add(model); _db.SaveChanges(); BackgroundJob.Enqueue(() => NotifyNewComment(model.Id)); } return(RedirectToAction("Index")); }
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")); }
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); }
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()); }
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")); }
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")); }