using APIFicheros.DTOs; using bdAsegasa; using bdAsegasa.db; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; using static Org.BouncyCastle.Math.EC.ECCurve; namespace APIFicheros.Controllers { [ApiController] [Route("[controller]")] public class ObtenerFicherosController : Controller { private readonly IConfiguration _configuration; private bdAsegasa.tscgestionasegasa bd; public ObtenerFicherosController(IConfiguration configuration) { _configuration = configuration; var nombreConexion = _configuration["Configuracion:NombreConexionBD"]; bd = tscgestionasegasa.NuevoContexto(nombreConexion, true, false, true, "ObtenerFicheros"); } [HttpPost("ObtenerFicherosFaltantes")] public ActionResult PostNombreBD([FromBody] string numeroPoliza) { try { int idPoliza = bd.polizassg.First(x => x.NumeroPoliza!.Contains(numeroPoliza)).idPoliza; List listadoDocumentos = new List(); List listadoFicherosFaltantes = new List(); listadoDocumentos = bd.documentospolizassg.Where(x => x.idPoliza == idPoliza && x.idFichero == null).ToList(); foreach (documentospolizassg documentoFaltante in listadoDocumentos) { listadoFicherosFaltantes.Add(new PolizasFaltantes { idDocumento = documentoFaltante.idDocumento, descripcion = documentoFaltante.idDocumentoASolicitarNavigation!.idTipoNavigation!.Descripcion }); } return Ok(listadoFicherosFaltantes); } catch (Exception ex) { return BadRequest("Ha ocurrido un error. Mensaje de error: " + ex.Message); } } } }