示例#1
0
        public async Task <ActionResult> GetOrderById(int id)
        {
            var order = await _services.GetOrderById(id);

            if (order == null)
            {
                return(NotFound());
            }

            return(Ok(order));
        }
        public IActionResult GetById(int id)
        {
            OrderRecord orderRecord;

            try
            {
                orderRecord = _ordersServices.GetOrderById(id);

                if (orderRecord == null)
                {
                    return(NotFound());
                }
            }
            catch (Exception oEx)
            {
                // TODO: if I have time to add logging
                //_staticLoggerInstanceWrapper.LogError(GetType(), oEx);

                return(StatusCode(StatusCodes.Status500InternalServerError, oEx));
            }

            return(Ok(orderRecord));
        }