Exemplo n.º 1
0
        public ActionResult SendDaily()
        {
            var follows = _followService.All();

            if (follows.Count == 0)
            {
                return(NoContent());
            }
            var quote  = _myService.RandomQuote();
            var emails = new List <string>();

            foreach (var follow in follows)
            {
                var user = _userService.GetById(follow.UserId);
                emails.Add(user.Email);
            }
            var message = new Message(emails, "Daily Quotes", quote.Quote);

            _emailSender.SendEmail(message);

            return(Ok());
        }