public ActionResult CambioPassword(CabioPassword modelo) { if (ModelState.IsValid) { var usuario = Session["Usuario"].ToString(); modelo.StrEmail = usuario; var vc = new Clases.SeguridadDao(); var res = vc.CambiodePassword(modelo, out _strMensaje); if (res) { ViewBag.mensaje = _strMensaje; return(View()); } else { ViewBag.Error = _strMensaje; return(View()); } } else { ViewBag.Error = "Los datos no estan correctos"; return(View()); } }
public bool CambiodePassword(CabioPassword modelo, out string strMensaje) { try { var parametros = new List <SqlParameter>() { new SqlParameter("@strEmail", modelo.StrEmail), new SqlParameter("@strPassWordAnterior", modelo.StrPasswordAnterior), new SqlParameter("@strPasswornew", modelo.StrPaswordNew) }; var mensaje = new SqlParameter("@strMensaje", SqlDbType.VarChar, 100) { Direction = ParameterDirection.Output }; var respuesta = new SqlParameter("@logRespuesta", SqlDbType.Bit) { Direction = ParameterDirection.Output }; parametros.Add(mensaje); parametros.Add(respuesta); var res = _datahelper.EjecutarSp <bool>("sp_sgCambioPassword", parametros); if (res) { strMensaje = mensaje.Value.ToString(); return(Convert.ToBoolean(respuesta.Value)); } else { strMensaje = "No hay conexion con el servidor"; return(false); } } catch (Exception ex) { strMensaje = ex.Message; return(false); } }