public async Task <bool> PlayByColor(BetByColorEntity bet) { if (bet.Amount < 1 || bet.Amount > 10000) { throw new Exception("El monto a apostar debe estar entre 1 y 10,000."); } RouletteEntity roulette = await GetFromCache(bet.IdRoulette); roulette.BetsByColor.Add(bet); await SaveToCache(roulette); return(true); }
public async Task <IActionResult> PlayByColor([FromHeader] string idUser, [FromBody] BetByColorEntity bet) { try { bet.IdUser = idUser; bool success = await _rouletteService.PlayByColor(bet); return(Ok(success)); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }