Exemple #1
0
        /// <summary>
        /// Method to open roulette
        /// </summary>
        /// <param name="rouletteId"> roulette identifier </param>
        /// <returns> Object with the transaction information </returns>
        public TransactionDTO <bool> RouletteOpening(long rouletteId)
        {
            TransactionDTO <bool> transaction = new TransactionDTO <bool>();

            transaction.Data = true;
            try
            {
                var getRouletteById = GetRouletteById(rouletteId);
                if (getRouletteById.Data.Id == 0)
                {
                    transaction.Data    = false;
                    transaction.Status  = getRouletteById.Status;
                    transaction.Message = getRouletteById.Message;
                }

                bool rouletteOpening = _rouletteRepository.RouletteOpening(rouletteId);
                if (!rouletteOpening)
                {
                    transaction.Data    = rouletteOpening;
                    transaction.Status  = Common.Status.Failure;
                    transaction.Message = "No fue posible realizar la apertura de la ruleta.";

                    return(transaction);
                }
            }
            catch (ArgumentException ex)
            {
                transaction.Data    = false;
                transaction.Status  = Common.Status.Failure;
                transaction.Message = ex.Message;
            }

            return(transaction);
        }