public IActionResult AddMarketBetTypes([FromBody] MarketBetType marketBetType) { try { if (marketBetType == null) { return(StatusCode(400, StatusCodes.ReturnStatusObject("No items have been provided."))); } var result = _marketRepository.AddMarketBetTypes(marketBetType); if (result) { _logger.LogInformation("Market Successfully Added"); return(StatusCode(200, StatusCodes.ReturnStatusObject("Successfully Added."))); } else { _logger.LogError("Market Bet Type Mapping Has Failed to Add. Market - {0}", marketBetType); return(StatusCode(400, StatusCodes.ReturnStatusObject("Market Bet Type Mapping failed to add."))); } } catch (Exception e) { _logger.LogError("Error Market failed to add . Error - {0} , Data - {1}", e.Message, marketBetType); return(StatusCode(400, StatusCodes.ReturnStatusObject("Error Market Bet Type Mapping Failed to Add."))); } }
public bool AddMarketBetTypes(MarketBetType marketBetType) { using (var connection = DatabaseService.SqlConnection()) { var parameters = new { marketBetType.MarketId, marketBetType.BetTypeId }; var result = connection.Execute("sp_AddMarketBetType", parameters, commandType: CommandType.StoredProcedure); return(result < 0); } }