public async Task <IActionResult> rap5Mt()
        {
            RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);

            // envoyer rapport
            rapportsClass.rapport5(DateTime.Now.Year, "*****@*****.**");
            TempData["message"] = "Rapport est envoyé";
            return(RedirectToAction("Index", "Admin"));
        }
        public async Task <IActionResult> Ventes(SendVentesReportViewModel sendVentesReportViewModel)
        {
            if (ModelState.IsValid)
            {
                // Créer et envoyer rapport PDF:
                RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);
                // Chercher l'admin courriel
                var userManager = _serviceProvider.GetRequiredService <UserManager <ApplicationUser> >();
                var userName    = await userManager.FindByNameAsync(User.Identity.Name);

                // envoyer rapport
                rapportsClass.rapport5(sendVentesReportViewModel.Year,
                                       userName.Email);

                return(RedirectToAction(nameof(Ventes)));
            }

            ViewBag.Years = new List <int> {
                2018
            };
            return(View(sendVentesReportViewModel));
        }
        public void rapport5()
        {
            RapportsClass rapportsClass = new RapportsClass(_context, this.ControllerContext, he);

            rapportsClass.rapport5(2018, "*****@*****.**");
        }