public IActionResult ObtainById(int id) { try { ExampleEntity entity = _repository.GetById(id); if (entity == null) { return(NoContent()); } return(Ok(entity)); } catch (Exception exception) { return(StatusCode(500, exception)); } }