コード例 #1
0
        public async Task <IActionResult> ToBet([FromHeader(Name = "IdClient")] int?IdClient, Bet oBet)
        {
            string Message = string.Empty;
            Guid   guid    = Guid.NewGuid();

            IdClient = IdClient == null ? 0 : IdClient;
            if (IdClient != 0)
            {
                if ((oBet.Number > -1 && oBet.Number < 37) || (oBet.Color.ToLower().Trim() == "rojo" || oBet.Color.ToLower().Trim() == "negro") && (oBet.Amount > 0 && oBet.Amount <= 10000))
                {
                    oBet.IdClient = IdClient;
                    oBet          = await _Roulette.ToBet(oBet);

                    Message = oBet.Messaje;
                }
                else
                {
                    Message     = "Apuesta Invalida";
                    oBet.Status = false;
                }
            }
            else
            {
                Message     = "Apuesta Invalida";
                oBet.Status = false;
            }
            return(StatusCode(200, new { Message = Message, Status = oBet.Status }));
        }