public bool CreateRouletteBet(RouletteBetPayload payload)
        {
            var roulette = GetRouletteById(payload.RouletteId);

            if (roulette == null || !roulette.Status)
            {
                return(false);
            }
            var rouletteBets = GetRouletteBets();
            var rouletteBet  = new RouletteBet
            {
                RouletteId       = payload.RouletteId,
                UserId           = payload.UserId,
                NumberOrColorBet = payload.NumberOrColorBet,
                MoneyBet         = payload.MoneyBet
            };

            rouletteBets.Add(rouletteBet);
            var rouletteBetsJson = JsonSerializer.Serialize(rouletteBets);
            var result           = _redisRepository.Set(_rouletteBetKey, rouletteBetsJson);

            return(result);
        }
Beispiel #2
0
        public IActionResult CreateRouletteBet([FromBody] RouletteBetPayload payload)
        {
            var responsePackage = _rouletteService.CreateRouletteBet(payload);

            return(Ok(responsePackage));
        }