public async Task <ActionResult> pvwAddRegistroGastos([FromBody] RegistroGastosDTO _sarpara)
        {
            RegistroGastosDTO _RegistroGastos = new RegistroGastosDTO();

            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/RegistroGastos/GetRegistroGastosById/" + _sarpara.Id);

                string valorrespuesta = "";
                if (result.IsSuccessStatusCode)
                {
                    valorrespuesta  = await(result.Content.ReadAsStringAsync());
                    _RegistroGastos = JsonConvert.DeserializeObject <RegistroGastosDTO>(valorrespuesta);
                }
                if (_RegistroGastos == null)
                {
                    _RegistroGastos = new RegistroGastosDTO();
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                throw ex;
            }
            return(PartialView(_RegistroGastos));
        }
        public async Task <ActionResult <RegistroGastos> > SaveRegistroGastos([FromBody] RegistroGastosDTO _RegistroGastosS)
        {
            {
                string valorrespuesta = "";
                try
                {
                    RegistroGastos _RegistroGastos = new RegistroGastos();
                    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/RegistroGastos/GetRegistroGastosById/" + _RegistroGastosS.Id);

                    _RegistroGastosS.FechaModificacion   = DateTime.Now;
                    _RegistroGastosS.UsuarioModificacion = HttpContext.Session.GetString("user");
                    if (result.IsSuccessStatusCode)
                    {
                        valorrespuesta  = await(result.Content.ReadAsStringAsync());
                        _RegistroGastos = JsonConvert.DeserializeObject <RegistroGastos>(valorrespuesta);
                    }
                    if (_RegistroGastos == null)
                    {
                        _RegistroGastos = new Models.RegistroGastos();
                    }
                    if (_RegistroGastos.Id == 0)
                    {
                        _RegistroGastosS.FechaCreacion   = DateTime.Now;
                        _RegistroGastosS.UsuarioCreacion = HttpContext.Session.GetString("user");
                        var insertresult = await Insert(_RegistroGastosS);
                    }
                    else
                    {
                        _RegistroGastosS.FechaCreacion   = DateTime.Now;
                        _RegistroGastosS.UsuarioCreacion = HttpContext.Session.GetString("user");
                        var updateresult = await Update(_RegistroGastosS.Id, _RegistroGastosS);
                    }
                }
                catch (Exception ex)
                {
                    _logger.LogError($"Ocurrio un error: { ex.ToString() }");
                    throw ex;
                }
                return(Json(_RegistroGastosS));
            }
        }