//[Auth]
        public ActionResult Update(Gerente modelo = null, string CPassword = "", string gerentes = "")
        {
            ViewBag.Respuesta         = null;
            ViewBag.Gerentes          = Funcion.Gerentes();
            ViewBag.Roles             = Funcion.Roles();
            modelo.FechaActualizacion = DateTime.Now;
            bool resultado = false;

            if (System.Web.HttpContext.Current.Session["Rol"] != null)
            {
                ViewBag.Type = System.Web.HttpContext.Current.Session["Rol"].ToString();
            }
            else
            {
                System.Web.HttpContext.Current.Session["Rol"] = "Alto";
            }


            string subEjecutada = System.Web.HttpContext.Current.Session["Rol"].ToString();

            if (Request.HttpMethod == "GET")
            {
                Gerente gerente = new Gerente();
                if (modelo.Id == EngineData.IdActivacion)
                {
                    ViewBag.Type = Funcion.DecodeBase64(EngineData.RegisterManager);
                    gerente      = Metodo.GetGerente(modelo.Email);
                    gerente.FechaActualizacion = DateTime.Now;
                    ViewBag.Type = "Bajo";
                    System.Web.HttpContext.Current.Session["Rol"]     = "Bajo";
                    System.Web.HttpContext.Current.Session["Usuario"] = EngineData.usuarioTemporal;
                    return(View(gerente));
                }
                else
                {
                    if (subEjecutada == "Alto")
                    {
                        ViewBag.Gerentes = Metodo.GetAllGerentes();
                        ViewBag.Type     = "Alto";
                    }
                    else
                    {
                        if (System.Web.HttpContext.Current.Session["Gerente"] != null)
                        {
                            string nombreUsuario = System.Web.HttpContext.Current.Session["Gerente"].ToString();
                            gerente      = Metodo.GetGerenteUserName(nombreUsuario);
                            ViewBag.Type = gerente.Rol;
                        }
                    }
                    gerente.FechaActualizacion = DateTime.Now;
                    return(View(gerente));
                }
            }


            if (Request.HttpMethod == "POST")
            {
                if (gerentes != string.Empty && gerentes != null)
                {
                    modelo.Nombre = gerentes;
                }

                if (subEjecutada == "Alto")
                {
                    if (modelo.Nombre == string.Empty || modelo.NombreUsuario == string.Empty || modelo.Email == string.Empty || modelo.Rol == string.Empty ||
                        modelo.Nombre == null || modelo.NombreUsuario == null || modelo.Email == null || modelo.Rol == null)
                    {
                        ViewBag.Type      = "Alto";
                        ViewBag.Respuesta = "Todos los campos son requeridos, completelos por favor";
                        return(View(modelo));
                    }

                    ViewBag.Gerentes = Metodo.GetAllGerentes();
                }
                else
                {
                    if (modelo.Nombre == string.Empty || modelo.NombreUsuario == string.Empty || modelo.Email == string.Empty || modelo.Password == string.Empty ||
                        CPassword == string.Empty || modelo.Nombre == null || modelo.NombreUsuario == null || modelo.Email == null || modelo.Password == null || CPassword == null)
                    {
                        ViewBag.Respuesta = "Todos los campos son requeridos, completelos por favor 2";
                        return(View(modelo));
                    }
                    resultado = Funcion.CompareString(modelo.Password, CPassword);
                    if (!resultado)
                    {
                        ViewBag.Respuesta = "Las contraseñas deben ser identicas";
                        return(View(modelo));
                    }
                    modelo.Password = Funcion.ConvertirBase64(modelo.NombreUsuario + modelo.Password);
                }
            }

            resultado = Metodo.PutGerente(modelo, subEjecutada);
            if (!resultado)
            {
                ViewBag.Respuesta = "Actualizacion fallida";
            }
            else
            {
                ViewBag.Respuesta = "Actualizacion exitosa";
            }

            if (System.Web.HttpContext.Current.Session["Gerente"] != null)
            {
                string nombreUsuario = System.Web.HttpContext.Current.Session["Gerente"].ToString();
                modelo       = Metodo.GetGerenteUserName(nombreUsuario);
                ViewBag.Type = modelo.Rol;
            }

            return(View(modelo));
        }