public IActionResult GetEmpresaBy(int id) { try{ Console.WriteLine("[GetEmpresaBy] -> buscar empresa con id: " + id); Empresa result = empresasService.FindEmpresaBy(id); RestResponse response = RestUtils.GenerateResponseOkEmpty(); if (result == null) { Console.WriteLine("[GetEmpresaBy] -> no hay resultados"); response.Header.Message = RestUtils.RESPONSE_NOTFOUND_MSG; return(NotFound(response)); } Console.WriteLine("[GetEmpresaBy] -> request exitosa"); response.Header.Message = RestUtils.RESPONSE_OK_MSG; response.AddObjectToData(result); return(Ok(response)); }catch (Exception exception) { Console.WriteLine("[GetEmpresaBy] -> " + RestUtils.RESPONSE_INTERNAL_ERROR_MSG); RestResponse response = RestUtils.GenerateResponseErrorWith( new ResponseError( exception.Message, exception.GetType().ToString() ) ); response.Header.Message = RestUtils.RESPONSE_INTERNAL_ERROR_MSG; return(StatusCode( StatusCodes.Status500InternalServerError, response )); } }