public IActionResult Get(int id) { ClienteBO clienteBO; ClienteModel cliente; ObjectResult response; try { _log.LogInformation($"Starting Get( {id} )"); clienteBO = new ClienteBO(_loggerFactory, _config); cliente = clienteBO.Get(id); if (cliente != null) { response = Ok(cliente); } else { response = NotFound(string.Empty); } _log.LogInformation($"Finishing Get( {id} )"); } catch (Exception ex) { _log.LogError(ex.Message); response = StatusCode(500, ex.Message); } return(response); }
public IActionResult Get(string name = null) { ClienteBO clienteBO; List <ClienteModel> clientes; ObjectResult response; try { _log.LogInformation("Starting Get()"); clienteBO = new ClienteBO(_loggerFactory, _config); clientes = clienteBO.Get(name); response = Ok(clientes); _log.LogInformation($"Finishing Get() with '{clientes.Count}' results"); } catch (Exception ex) { _log.LogError(ex.Message); response = StatusCode(500, ex.Message); } return(response); }