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

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

            catch (Exception e)
            {
                _logger.LogError("API Request (UPDATE TournamentBettype) FAILED: ", e);
                return(BadRequest("Failed"));
            }
        }
コード例 #2
0
        public IActionResult PostTournamentBettype([FromBody] TournamentBettype tournamentBettype)
        {
            try
            {
                if (tournamentBettype != null)
                {
                    _logger.LogInformation("API Request hit: INSERT TournamentBettype : ");
                    var result = _bettypeRepository.AddTournamentBettype(tournamentBettype);

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

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