Example #1
0
        public int Add(BetSlipIterm entity)
        {
            int rowAffected             = 0;
            DynamicParameters parameter = new DynamicParameters();

            using (var connection = DbService.sqlConnection())
            {
                if (connection.State == ConnectionState.Closed)
                {
                    connection.Open();
                }
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("@odds", entity.BetSlip.Odds);
                parameters.Add("@StakeAmount", entity.BetSlip.StakeAmount);
                parameters.Add("@UserAccount", entity.BetSlip.UserAccount);
                rowAffected = connection.Execute("AddBetSlip", parameters, commandType: CommandType.StoredProcedure);
                foreach (var item in entity.BetIterm)
                {
                    parameter.Add("@BetSlipId", item.BetSlipId);
                    parameter.Add("@SportID", item.SportId);
                    parameter.Add("@BetTypeId", item.BetTypeId);
                    parameter.Add("@EventID", item.EventId);
                    parameter.Add("@MarketID", item.MarketId);
                    parameter.Add("@Date", item.Date);
                    parameter.Add("@TicketNumber", item.TicketNumber);
                    parameter.Add("@Status", item.Status);
                    rowAffected += connection.Execute("AddBetSlipIterm", parameter, commandType: CommandType.StoredProcedure);
                }
                return(rowAffected);
            }
        }
Example #2
0
        public IActionResult BetStrike(BetSlipIterm betSlipIterm)
        {
            try
            {
                if (betSlipIterm == null)
                {
                    _logger.LogError("betSlipIterm object sent from client is null.");
                    return(BadRequest("betSlipIterm object is null"));
                }

                if (!ModelState.IsValid)
                {
                    _logger.LogError("betSlipIterm object sent from client.");
                    return(BadRequest("Invalid model object"));
                }
                _Ibetslipiterm.Add(betSlipIterm);
                return(Ok());
            }
            catch (Exception ex)
            {
                _logger.LogError($"Something went wrong inside BetStrike action: {ex.Message}");
                return(StatusCode(500, "Internal server error" + ex));
            }
        }
Example #3
0
 public int Update(BetSlipIterm entity)
 {
     throw new NotImplementedException();
 }