コード例 #1
0
        public IActionResult UpdateTournamentSC([FromBody] TournamentSc tournamentsc)
        {
            try
            {
                if (tournamentsc != null)
                {
                    _logger.LogInformation("API Request hit: UPDATE TournamentSC : " + tournamentsc.Id);
                    var result = _tournamentRepository.UpdateTournamentSC(tournamentsc);

                    if (result == 0)
                    {
                        return(Ok("{\"status\": \"Success\"}"));
                    }
                    else
                    {
                        _logger.LogInformation("API Request (UPDATE TournamentSC : " + tournamentsc.Id + " ) not committed");
                        return(NotFound("Failed: UPDATE could not commit"));
                    }
                }
                else
                {
                    _logger.LogInformation("API Request hit (UPDATE TournamentSC) with null entry");
                    return(BadRequest("Failed: null entry"));
                }
            }

            catch (Exception e)
            {
                _logger.LogError("API Request (UPDATE TournamentSC) FAILED: ", e);
                return(BadRequest("Failed"));
            }
        }
コード例 #2
0
        public IActionResult PostTournamentSC([FromBody] TournamentSc tournamentSc)
        {
            try
            {
                if (tournamentSc != null)
                {
                    _logger.LogInformation("API Request hit: INSERT TournamentSc : ");
                    var result = _tournamentRepository.AddTournamentSC(tournamentSc);

                    if (result == 0)
                    {
                        return(Ok("{\"status\": \"Success\"}"));
                    }
                    else
                    {
                        _logger.LogInformation("API Request (INSERT TournamentSc : ) not committed");
                        return(NotFound("Failed: INSERT could not commit"));
                    }
                }
                else
                {
                    _logger.LogInformation("API Request hit (INSERT TournamentSc) with null entry");
                    return(BadRequest("Failed: null entry"));
                }
            }

            catch (Exception e)
            {
                _logger.LogError("API Request (INSERT TournamentSc) FAILED: ", e);
                return(BadRequest("Failed"));
            }
        }
コード例 #3
0
 public int UpdateTournamentSC(TournamentSc entity)
 {
     using (var connection = DBService.GetSqlConnection())
     {
         var result = connection.Execute($"EXECUTE dbo.UpdateTournamentSC {entity.Id},{entity.TournamentId},{entity.CountryId},{entity.SportId}");
         return(result + 1);
     }
 }