fix, ruta del archivo del logo de gemco que estaba escrita directamente en el codigo

feature/Reporte_Relacion_Facturas_Alen
Felix Morales 11 months ago
parent 39a417f73d
commit 3170c5b486
  1. 10
      Controllers/Corresponsalias/AnticiposController.cs

@ -28,6 +28,8 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
private readonly IConfiguration _config;
private readonly IFileManagerRepository _fileManager;
private readonly ICorresponsaliasTraficosRepository _traficoRepository;
private readonly string _rootPathCorresponsales;
private readonly string _logoGemcoPath;
public AnticiposController(ICorresponsaliasAnticiposRepository Repo, IConfiguration config, IFileManagerRepository fileManager, ICorresponsaliasTraficosRepository traficoRepository)
{
@ -35,6 +37,8 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
_Repo = Repo;
_fileManager = fileManager;
_traficoRepository = traficoRepository;
_rootPathCorresponsales = _config.GetValue<string>("AllFiles");
_logoGemcoPath = _config.GetValue<string>("LogoGemco");
}
[HttpPost]
@ -88,6 +92,7 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
[HttpGet("Download")]
public async Task<IActionResult> Download([FromQuery] int idTrafico, [FromQuery] int idAnticipo){
try{
var trafico = await _traficoRepository.Get(idTrafico);
var anticipos = await _Repo.getAll(idTrafico);
var anticipo = anticipos.First(x => x.id == idAnticipo);
@ -100,7 +105,7 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
doc.SetFont(font);
doc.SetMargins(25, 25, 25, 25);
#region Encabezado
String imageFile = "C:\\data\\Corresponsales\\Img\\LogoGemco.png";
String imageFile = $"{_rootPathCorresponsales}{_logoGemcoPath}LogoGemco.png";
ImageData data = ImageDataFactory.Create(imageFile);
Image img = new Image(data);
Table headerTable = new Table(3).UseAllAvailableWidth();
@ -159,6 +164,9 @@ namespace CORRESPONSALBackend.Controllers.Corresponsalias
ms.Position = 0;
return new FileStreamResult(ms, "application/pdf");
}catch(Exception ex){
return BadRequest(ex.Message);
}
}
}
}
Loading…
Cancel
Save