Miglioramento enabled (HOPE!!!)

This commit is contained in:
Samuele Locatelli
2026-04-16 08:40:44 +02:00
parent 875b0109f3
commit 8cf048fb4e
3 changed files with 184 additions and 7 deletions
+11 -6
View File
@@ -88,18 +88,23 @@ namespace MP.IOC.Controllers
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("enabled/{id}")]
public IActionResult Enabled(string id)
public async Task<IActionResult> Enabled(string id)
{
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
if (DService.IobInsEnab(id))
try
{
return Ok("OK");
// Il metodo ora restituisce direttamente il booleano logico
bool isEnabled = await DService.IobInsEnabAsync(id);
return isEnabled
? Ok("OK")
: UnprocessableEntity("NO");
}
else
catch (Exception ex)
{
//return StatusCode(503, "NO");
return UnprocessableEntity("NO");
Log.Error(ex, "Errore durante la verifica abilitazione per {Id}", id);
return StatusCode(500, "Errore interno del server");
}
}