Example #1
0
        public async Task <ActionResult <Inquiry> > GetAsync(int id)
        {
            try
            {
                _logger.LogDebug("Fetching Inquiry Item");
                var inquiry = await _inquiryService.Get(id);

                if (inquiry != null)
                {
                    _logger.LogDebug("Inquiry Item found. Returning Fetched Item");
                    return(Ok(inquiry));
                }
                else
                {
                    _logger.LogDebug("Inquiry Item not found");
                    return(Conflict("Inquiry not Found"));
                }
            }
            catch (Exception ex)
            {
                //Log error
                _logger.LogError("An Exception occured: {ex}", ex.Message);
                _logger.LogError("Stack Trace: {ex}", ex.StackTrace);
                return(BadRequest(ex));
            }
        }