Exemple #1
0
        public async Task <IActionResult> DescargarListaContratoTotal()
        {
            string nombreArchivo = "ListaContrato.xlsx";

            try
            {
                valorPciId = User.FindFirst(ClaimTypes.Role).Value;
                if (!string.IsNullOrEmpty(valorPciId))
                {
                    pciId = int.Parse(valorPciId);
                }

                var lista = await _repo.ObtenerListaContratoTotal(pciId);

                if (lista != null)
                {
                    DataTable dtResultado = _procesoCreacionExcelInterface.ObtenerTablaDeListaContrato(lista.ToList());
                    return(_procesoCreacionExcelInterface.ExportExcel(Response, dtResultado, nombreArchivo));
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(BadRequest());
        }