public IActionResult Put([FromBody] Tournament tournament)
        {
            try
            {
                if (tournament.Equals(null))
                {
                    return(StatusCode(400, StatusCodes.ReturnStatusObject("The was no data present.")));
                }
                var result = _tournamentRepository.Update(tournament);

                if (result)
                {
                    _logger.LogInformation("Tournament ID : {0} successfully updated.", tournament.TournamentId);
                    return(StatusCode(200, StatusCodes.ReturnStatusObject($"{tournament.TournamentId} was Successfully Updated.")));
                }
                else
                {
                    _logger.LogError("Tournament ID : {0} was not updated.", tournament.TournamentId);
                    return(StatusCode(400, StatusCodes.ReturnStatusObject($"Update was unsuccessful.")));
                }
            }
            catch (Exception e)
            {
                _logger.LogError("The Tournament update has failed. Error - {0}", e.Message);
                return(StatusCode(400, StatusCodes.ReturnStatusObject("The update has failed.")));
            }
        }
示例#2
0
 public int Put([FromBody] Tournament tournament)
 {
     return(_tournament.Update(tournament));
 }