Exemple #1
0
        public IActionResult GerarCSVNewsletter()
        {
            var news = _newsletterRepository.ObterTodosNewsletter();

            StringBuilder sb = new StringBuilder();

            foreach (var email in news)
            {
                sb.AppendLine(email.Email);
            }

            byte[] buffer = Encoding.ASCII.GetBytes(sb.ToString());
            return(File(buffer, "text/csv", $"newsletter.csv"));
        }