Example #1
0
        public ActionResult OpenRoulette(Guid rouletteId)
        {
            if (!_casinoRepository.RouletteExists(rouletteId))
            {
                return(NotFound());
            }
            var rouletteFromRepo = _casinoRepository.GetRoulette(rouletteId);

            if (rouletteFromRepo == null)
            {
                return(NotFound());
            }
            if (!_casinoRepository.RouletteIsCreated(rouletteId))
            {
                return(BadRequest("La ruleta ya esta abierta o ya se ha cerrado"));
            }
            var rouletteToUpdate = new RouletteToUpdate();

            rouletteToUpdate.State = "open";
            _mapper.Map(rouletteToUpdate, rouletteFromRepo);
            _casinoRepository.UpdateRoulette(rouletteFromRepo);
            _casinoRepository.Save();

            return(Ok("Se abrio la ruleta exitosamente"));
        }
Example #2
0
        public ActionResult <IEnumerable <BetDto> > GetBetsForRoulette(Guid rouletteId)
        {
            if (!_casinoRepository.RouletteExists(rouletteId))
            {
                return(NotFound());
            }
            var betsFromRepo = _casinoRepository.GetBets(rouletteId);

            return(Ok(_mapper.Map <IEnumerable <BetDto> >(betsFromRepo)));
        }