public IActionResult GetBetSlip(long?id) { try { if (id.HasValue) { _logger.LogInformation("API Request hit: GET all BetSlip by BetSlipId: " + id.Value); var result = _betRepository.GetBetSlip(id.Value); if (result.ToList().Any()) { return(Ok(result)); } else { _logger.LogInformation("API Request (GET all BetSlip by BetSlipId: " + id.Value + " ) no entries found"); return(NotFound("BetSlip was not found with BetSlipId: " + id.Value)); } } else { _logger.LogInformation("API Request hit: GET all BetSlips by no criteria"); var result = _betRepository.GetAllBetSlip(); return(Ok(result)); } } catch (Exception e) { _logger.LogError("API Request (GET all BetSlip by BetSlipId) FAILED: ", e); return(BadRequest()); } }