public ActionResult SendSingleInvoices()
        {
            var email = new EmailViewModel
            {
                To      = "*****@*****.**",
                Message = "June Invoice"
            };

            //Get user invoice
            var invoiceToSend    = Stream("pdf", 2);
            var attachmentStream = new MemoryStream(invoiceToSend);
            var contentType      = new System.Net.Mime.ContentType(System.Net.Mime.MediaTypeNames.Application.Pdf);

            email.Attach(new Attachment(attachmentStream, "Lindsey Drew Invoice", contentType.ToString()));
            email.Send();

            return(Json("test", JsonRequestBehavior.AllowGet));
        }
        public ActionResult SendAllInvoices()
        {
            //Get all users
            var AllUsers = db.Customer.ToList();

            int count = 0;

            foreach (var item in AllUsers)
            {
                var email            = new EmailViewModel();
                var InvoiceId        = db.Invoices.Where(x => x.CustomerId == item.Id).FirstOrDefault().Id;
                var invoiceToSend    = Stream("pdf", InvoiceId);
                var attachmentStream = new MemoryStream(invoiceToSend);
                var contentType      = new System.Net.Mime.ContentType(System.Net.Mime.MediaTypeNames.Application.Pdf);
                email.To      = item.Email;
                email.Message = "June Invoice";
                email.Attach(new Attachment(attachmentStream, "The Grind Invoice", contentType.ToString()));
                email.Send();

                count++;
            }
            return(Json(count.ToString(), JsonRequestBehavior.AllowGet));
            // return View();
        }