Beispiel #1
0
        public ActionResult UsuarioConfig()
        {
            _usuario = ConfigurationManager.AppSettings.Get("Usuario");
            _senha   = ConfigurationManager.AppSettings.Get("Senha");

            var usuario = new UsuarioConfigPortalRhViewModel
            {
                Usuario = _usuario,
                Senha   = _senha
            };

            return(View(usuario));
        }
Beispiel #2
0
        public ActionResult UsuarioConfig(UsuarioConfigPortalRhViewModel config)
        {
            try
            {
                var currentconfig = WebConfigurationManager.OpenWebConfiguration("~");
                XmlHandler.WriteSetting(currentconfig, "Usuario", config.Usuario.ToString());
                XmlHandler.WriteSetting(currentconfig, "Senha", config.Senha.ToString());
                ViewBag.Mensagem = "Registro alterado com sucesso.";
            }
            catch (Exception ex)
            {
                ViewBag.MensagemErro = ex.Message;
                //throw ex;
            }


            return(View(config));
        }