コード例 #1
0
        public BetResponse GetBetResponse()
        {
            var response = new BetResponse()
            {
                Id         = this.Id,
                Number     = this.Number,
                RouletteId = this.RouletteId,
                Value      = this.Value,
                Color      = this.Color == 0 ? string.Empty : this.Color.ToString("g"),
                UserId     = this.UserId
            };

            return(response);
        }
コード例 #2
0
        public ActionResult Bet([FromHeader] string gamblerId, [FromBody] BetRequest betRequest)
        {
            try
            {
                BetResponse objBetResponse = gamblingService.Bet(gamblerId, betRequest);
                if (objBetResponse == null && !string.IsNullOrEmpty(gamblingService.ErrorMessage))
                {
                    return(BadRequest(gamblingService.ErrorMessage));
                }

                return(Ok(objBetResponse));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.Message));
            }
        }
コード例 #3
0
 public static DbBet ToDbBet(BetResponse betResponse)
 {
     return(new DbBet
     {
         OriginalDate = betResponse.Date.ToUTC().Rfc1123,
         BetResult = betResponse.BetResult.ToInt(),
         MatchId = betResponse.MatchId,
         Odds = betResponse.Odds,
         OriginalStake = betResponse.Stake,
         Pick = new DbPick {
             Choice = betResponse.PickChoice, Value = betResponse.PickValue
         },
         OriginalHomeName = betResponse.MatchHomeName,
         OriginalAwayName = betResponse.MatchAwayName,
         OriginalLeagueName = betResponse.LeagueName,
         OriginalDiscipline = betResponse.Discipline.ToIntN(),
         OriginalMatchResultString = $"{betResponse.HomeScore} - {betResponse.AwayScore}"
     });
 }
コード例 #4
0
ファイル: CBet.cs プロジェクト: GARO99/rouletteGambling
        public BetResponse BuilBetResponse(int betId, string gamblerId)
        {
            try
            {
                GamblingEntity objGambling = gamblingModel.GetOneGambling(betId, gamblerId);
                GamblerEntity  objGambler  = gamblerModel.GetOneGambler(objGambling.GamblerId);
                BetResponse    objResponse = new BetResponse
                {
                    GamblerId       = objGambler.Id,
                    GamblerFullName = objGambler.FullName,
                    CreditsBet      = objGambling.CreditsBet,
                    BetType         = Enum.GetName(typeof(BetTypeEnum), objGambling.BetType),
                    BetNumber       = objGambling.BetNumber,
                    BetColor        = objGambling.BetColor != null?Enum.GetName(typeof(ColorBetEnum), objGambling.BetColor) : null
                };

                return(objResponse);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }