Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpGet("{id}", Name = "Get")]
- public IActionResult Get(string id)
- {
- try
- {
- ObjectResult result;
- Documents documents = Consulta.Consul(id);
- if (documents.CaseNumber == null)
- {
- result = new ObjectResult("No existe informacion con el ID de transacción: " + id)
- {
- StatusCode = (int)HttpStatusCode.InternalServerError
- };
- _logger.LogWarning(DateTime.Now.ToString() + "--No existe informacion con el ID de transacción: " + id);
- return result;
- }
- else
- {
- result = new ObjectResult(documents)
- {
- StatusCode = (int)HttpStatusCode.OK
- };
- _logger.LogInformation(DateTime.Now.ToString() + "--Consulta correcta: " + id);
- return result;
- }
- }
- catch(Exception ex)
- {
- ObjectResult result = new ObjectResult(ex.ToString())
- {
- StatusCode = (int)HttpStatusCode.InternalServerError
- };
- _logger.LogError(DateTime.Now.ToString() + "--" + ex.ToString());
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement