public IActionResult Post([FromBody] BetType betType) { try { if (betType == null) { return(StatusCode(400, StatusCodes.ReturnStatusObject("No items have been provided."))); } var result = _betTypeRepository.Add(betType); if (result) { _logger.LogInformation("Bet Type Successfully Added"); return(StatusCode(200, StatusCodes.ReturnStatusObject("Successfully Added."))); } else { _logger.LogError("Bet Type has Failed to Add. Bet Type - {0}", betType); return(StatusCode(400, StatusCodes.ReturnStatusObject("Bet Type failed to add."))); } } catch (Exception e) { _logger.LogError("Error Bet Type failed to add . Error - {0} , Data - {1}", e.Message, betType); return(StatusCode(400, StatusCodes.ReturnStatusObject("Error Bet Type Failed to Add."))); } }
public int Post([FromBody] BetTypes betTypes) { return(_betType.Add(betTypes)); }