public ActionResult ModificaUtente(ModificaUtenteModel model) { ActionResult result = null; if (ModelState.IsValid) { MembershipService service = new MembershipService(); Utente utente = service.RecuperaUtente(model.Id); utente.Cognome = model.Cognome; utente.Nome = model.Nome; utente.Email = model.Email; utente.Abilitato = model.Abilitato; model.NomeUtente = utente.NomeUtente; model.DataUltimoLogin = utente.DataUltimoLogin; model.DataUltimoCambioPassword = utente.DataUltimoCambioPassword; Utente utenteCorrente = User.Utente; if (utenteCorrente.ID == utente.ID) { model.UtenteCorrente = true; } else { model.UtenteCorrente = false; } service.ModificaUtente(utente); result = RedirectToAction("ModificaUtente", new { id = model.Id }); } else { result = View(model); } return(result); }
public ActionResult ModificaUtente(int id) { ActionResult result = null; ModificaUtenteModel model = new ModificaUtenteModel(); MembershipService service = new MembershipService(); Utente utente = service.RecuperaUtente(id); Utente utenteCorrente = MembershipUtils.RecuperaUtenteCorrente(); if (utenteCorrente.ID == utente.ID) { model.UtenteCorrente = true; } else { model.UtenteCorrente = false; } //UtenteRepository.Instance.RecuperaUtenteDaEmail(utente.Email); if (utente != null) { model.Id = id; model.Nome = utente.Nome; model.NomeUtente = utente.NomeUtente; model.DataUltimoLogin = utente.DataUltimoLogin; model.Cognome = utente.Cognome; model.Email = utente.Email; model.Abilitato = utente.Abilitato; model.DataUltimoCambioPassword = utente.DataUltimoCambioPassword; result = View(model); } else { result = HttpNotFound(); } return(result); }