diff --git a/MP.IOC/Controllers/IOBController.cs b/MP.IOC/Controllers/IOBController.cs index d0fd5e7f..c1239fab 100644 --- a/MP.IOC/Controllers/IOBController.cs +++ b/MP.IOC/Controllers/IOBController.cs @@ -58,21 +58,34 @@ namespace MP.IOC.Controllers /// /// [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 } /// @@ -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