Correzione codici ritorno chiamate IOB

This commit is contained in:
Samuele Locatelli
2026-04-10 17:50:14 +02:00
parent d37618feb5
commit d6bc7e313a
+19 -6
View File
@@ -58,21 +58,34 @@ namespace MP.IOC.Controllers
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("enabled/{id}")]
public string enabled(string id)
public IActionResult enabled(string id)
{
if (string.IsNullOrEmpty(id)) return "KO";
if (string.IsNullOrEmpty(id)) return BadRequest("Missing ID");
if (DService.IobInsEnab(id))
{
return Ok("OK");
}
else
{
return UnprocessableEntity("NO"); // O un altro errore appropriato
//return StatusCode(503, "NO"); // O un altro errore appropriato
}
#if false
if (string.IsNullOrEmpty(id)) return Ok("KO");
try
{
var result = DService.IobInsEnab(id) ? "OK" : "NO";
// Logga solo l'esito se necessario
return result;
return Ok(result);
}
catch (Exception exc)
{
Log.Error($"Errore in enabled {id}: {exc.Message}");
return "NO";
return Ok("NO");
}
#endif
}
/// <summary>
@@ -100,7 +113,7 @@ namespace MP.IOC.Controllers
}
[HttpGet("version")]
public string version()
public IActionResult version()
{
var version = Assembly
.GetExecutingAssembly()
@@ -108,7 +121,7 @@ namespace MP.IOC.Controllers
.Version?
.ToString() ?? "unknown";
return version;
return Ok(version);
}
#endregion Public Methods