예제 #1
0
        public async Task <ActionResult> Bet([FromBody] Models.Bet bet)
        {
            if (ModelState.IsValid)
            {
                var roulette = await _repository.GetRoulette(bet.RouletteId);

                if (roulette != null)
                {
                    if (roulette.Status)
                    {
                        var result = _mapper.Map <Entities.Bet>(bet);
                        return(Ok(await _repository.BetRoulette(bet.RouletteId, result)));
                    }
                    else
                    {
                        return(BadRequest("Error ruleta Cerrada"));
                    }
                }
                else
                {
                    return(BadRequest("Identificador de ruleta no existe"));
                }
            }

            return(BadRequest(ModelState));
        }