public IActionResult Find(int?tournamentId) { try { if (!tournamentId.HasValue) { return(BadRequest("Invalid Input.")); } var result = _tournamentRepository.Find(tournamentId); if (result != null) { _logger.LogInformation($"ID : {tournamentId} has been successfully found."); return(Ok(result)); } else { _logger.LogError("Tournament ID : {0} was not found.", tournamentId); return(StatusCode(404, StatusCodes.ReturnStatusObject("Tournament Not Found."))); } } catch (Exception e) { _logger.LogError("Failed to located Tournament. Error - {0}", e.Message); return(StatusCode(400, StatusCodes.ReturnStatusObject("Something went wrong."))); } }