Exemplo n.º 1
0
        public async Task SendEmailToSubscribersAsync(SendNewsBindingModel model)
        {
            var subscribers = await _db
                              .Subscribers
                              .ToListAsync();

            foreach (var subscriber in _db.Subscribers)
            {
                await _emailSender.SendEmailAsync(subscriber.Email, model.Subject, model.Message);
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> SendNewspaper(SendNewsBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            await _adminManager.SendEmailToSubscribersAsync(model);

            TempData["Success"] = "You successfully sent an email to all of our subscribers.";

            return(RedirectToAction("SendNewspaper"));
        }