//public async Task<ActionResult> pvwElementoConfiguracion(Int64 Id = 0)
        public async Task <ActionResult> pvwElementoConfiguracion([FromBody] ElementoConfiguracionDTO _sarpara)
        {
            //ElementoConfiguracion _ElementoConfiguracion = new ElementoConfiguracion();
            ElementoConfiguracionDTO _ElementoConfiguracion = new ElementoConfiguracionDTO();

            try
            {
                string     baseadress = config.Value.urlbase;
                HttpClient _client    = new HttpClient();
                _client.DefaultRequestHeaders.Add("Authorization", "Bearer " + HttpContext.Session.GetString("token"));
                var result = await _client.GetAsync(baseadress + "api/ElementoConfiguracion/GetElementoConfiguracionById/" + _sarpara.Id);

                string valorrespuesta = "";
                if (result.IsSuccessStatusCode)
                {
                    valorrespuesta         = await(result.Content.ReadAsStringAsync());
                    _ElementoConfiguracion = JsonConvert.DeserializeObject <ElementoConfiguracionDTO>(valorrespuesta);
                }

                if (_ElementoConfiguracion == null)
                {
                    _ElementoConfiguracion = new ElementoConfiguracionDTO();
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                throw ex;
            }



            return(PartialView(_ElementoConfiguracion));
        }
        public async Task <ActionResult <ElementoConfiguracion> > SaveElementoConfiguracion([FromBody] ElementoConfiguracionDTO _ElementoConfiguracionS)
        {
            ElementoConfiguracion _ElementoConfiguracion = _ElementoConfiguracionS;

            try
            {
                ElementoConfiguracion _listElementoConfiguracion = new ElementoConfiguracion();
                string     baseadress = config.Value.urlbase;
                HttpClient _client    = new HttpClient();
                _client.DefaultRequestHeaders.Add("Authorization", "Bearer " + HttpContext.Session.GetString("token"));
                var result = await _client.GetAsync(baseadress + "api/ElementoConfiguracion/GetElementoConfiguracionById/" + _ElementoConfiguracion.Id);

                string valorrespuesta = "";
                _ElementoConfiguracion.FechaModificacion   = DateTime.Now;
                _ElementoConfiguracion.UsuarioModificacion = HttpContext.Session.GetString("user");

                if (result.IsSuccessStatusCode)
                {
                    valorrespuesta         = await(result.Content.ReadAsStringAsync());
                    _ElementoConfiguracion = JsonConvert.DeserializeObject <ElementoConfiguracionDTO>(valorrespuesta);
                }

                if (_ElementoConfiguracion == null)
                {
                    _ElementoConfiguracion = new Models.ElementoConfiguracion();
                }

                if (_ElementoConfiguracionS.Id == 0)
                {
                    _ElementoConfiguracionS.FechaCreacion   = DateTime.Now;
                    _ElementoConfiguracionS.UsuarioCreacion = HttpContext.Session.GetString("user");

                    //if (_ElementoConfiguracionS.Estado == "Activo")
                    //{
                    //    _ElementoConfiguracionS.Estado = "A";
                    //}
                    //else {
                    //    _ElementoConfiguracionS.Estado = "I";

                    //}

                    var insertresult = await Insert(_ElementoConfiguracionS);
                }
                else
                {
                    _ElementoConfiguracionS.UsuarioCreacion = _ElementoConfiguracion.UsuarioCreacion;
                    _ElementoConfiguracionS.FechaCreacion   = _ElementoConfiguracion.FechaCreacion;
                    var updateresult = await Update(_ElementoConfiguracion.Id, _ElementoConfiguracionS);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                throw ex;
            }

            return(Json(_ElementoConfiguracion));
        }