public ActionResult SendMailingList(DateTime dataApprovazione)
 {
     var vr = new ViaggioRepository();
     var viaggi = vr.GetApproved().Where(c => c.DataApprovazione >= dataApprovazione);
     if (viaggi.Count() > 0)
     {
         var ar = new AgenziaRepository();
         var agenzie = ar.GetAllAgenzie(100, 0);
         if (agenzie.Count > 0)
         {
             var mh = new MailerHelper();
             var mlh = new MailingListHelper();
             var mailText = mlh.GetMailingList(viaggi.ToList());
             foreach (var agenzia in agenzie)
                 mh.SendMail(agenzia.Email, mailText);
         }
     }
     return RedirectToAction("AdminDashBoard", "Dashboard");
 }
 public ActionResult ResetPassword(string email)
 {
     var ar = new AgenziaRepository();
     var agency = ar.GetByEmail(email);
     if (agency != null)
     {
         CryptoHelper cryptoHelper = new CryptoHelper();
         var random = new Random();
         var password = random.Next().ToString();
         agency.Password = cryptoHelper.CryptPassword(password);
         ar.Save(agency);
         var mailerHelper = new MailerHelper();
         var text = string.Format("Gentile {0} la tua nuova password di Parti Comodo è: {1}", agency.Nome, password);
         mailerHelper.SendMail(email, text);
     }
     var viewModel = new RegisterViewModel();
     return View("Register", viewModel);
 }