Miglioramento enabled (HOPE!!!)
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user