コード例 #1
0
        public async Task <ActionResult <UXO> > GetUXOData(string uxoid)
        {
            try
            {
                var uxo = await _uxoService.FetchUXO(uxoid);

                if (uxo == null)
                {
                    return(NotFound(new ErrorResponse()
                    {
                        StatusCode = (int)HttpStatusCode.NotFound, Message = $"Unable to retrieve item '{uxoid}'"
                    }));
                }
                return(Ok(uxo));
            }
            catch (Exception ex)
            {
                _logger.LogError($"Get UXO failed. Message=[{ex.Message}]");
                return(StatusCode(
                           (int)HttpStatusCode.InternalServerError,
                           new ErrorResponse()
                {
                    StatusCode = (int)HttpStatusCode.InternalServerError, Message = $"Unable to retrieve item '{uxoid}'"
                }
                           ));
            }
        }
コード例 #2
0
 public async Task <UXO> GetUXOData(string uxoid)
 {
     return(await _uxoService.FetchUXO(uxoid));
 }