예제 #1
0
 public async Task <ActionResult <List <Inquiry> > > GetAllAsync()
 {
     try
     {
         _logger.LogDebug("Fetching Inquiries");
         var inquiry = _inquiryService.GetAll();
         if (inquiry != null)
         {
             _logger.LogDebug("Inquiries Found. Returning fetched Inquiries.");
             return(Ok(inquiry));
         }
         else
         {
             _logger.LogDebug("No Inquiries Found");
             return(Conflict("No Inquiries Found"));
         }
     }
     catch (Exception ex)
     {
         //Log error
         _logger.LogError("An Exception occured: {ex}", ex.Message);
         _logger.LogError("Stack Trace: {ex}", ex.StackTrace);
         return(BadRequest(ex));
     }
 }