Esempio n. 1
0
        public IActionResult GetAllOddInfo(long?oddid)
        {
            try
            {
                if (oddid.HasValue)
                {
                    _logger.LogInformation("API Request hit: GET all OddInfo by Id: " + oddid.Value);
                    var result = _marketRepository.GetOddInfo(oddid.Value);
                    if (result.ToList().Any())
                    {
                        return(Ok(result));
                    }
                    else
                    {
                        _logger.LogInformation("API Request (GET all Markets by OddInfo: " + oddid.Value + " ) no entries found");
                        return(NotFound("TournamentBettypeInfo was not found with Id: " + oddid.Value));
                    }
                }
                else
                {
                    _logger.LogInformation("API Request hit: GET all OddInfo by no criteria");
                    var result = _marketRepository.GetAllOddInfo();
                    return(Ok(result));
                }
            }

            catch (Exception e)
            {
                _logger.LogError("API Request (GET all OddInfo by Id) FAILED: ", e);
                return(BadRequest("Failed"));
            }
        }