public ActionResult Save(Agenzia agenzia) { if (ModelState.IsValid) { ar.Save(agenzia); } return(RedirectToAction("Edit", new { id = agenzia.Id })); }
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)); }
public ActionResult Register(RegisterViewModel viewModel) { if (ModelState.IsValid) { CryptoHelper cryptoHelper = new CryptoHelper(); var agency = viewModel.Agenzia; agency.Password = cryptoHelper.CryptPassword(agency.Password); var ar = new AgenziaRepository(); ar.Save(agency); Session.Login(agency); if (agency.IsTourOperator) { return(RedirectToAction("TourOperatorDashboard", "Dashboard", new { id = agency.Id })); } return(RedirectToAction("AgenziaDashboard", "Dashboard", new { id = agency.Id })); } else { return(View(viewModel)); } }