Example #1
0
        /// <summary>
        /// Method to get all roulette records
        /// </summary>
        /// <returns> Object with the transaction information </returns>
        public TransactionDTO <List <RouletteDTO> > GetAllRoulette()
        {
            TransactionDTO <List <RouletteDTO> > transaction = new TransactionDTO <List <RouletteDTO> >();

            transaction.Data = new List <RouletteDTO>();
            try
            {
                var getAllRoulette = _rouletteRepository.GetAllRoulette();
                if (getAllRoulette == null || getAllRoulette.Count == 0)
                {
                    transaction.Status  = Common.Status.Failure;
                    transaction.Message = "No fue posible obtener los registros de las ruletas.";

                    return(transaction);
                }
                foreach (var item in getAllRoulette)
                {
                    RouletteDTO roulette = new RouletteDTO(item.Id, item.Name, item.Code, item.AllowBets);
                    transaction.Data.Add(roulette);
                }
            }
            catch (ArgumentException ex)
            {
                transaction.Status  = Common.Status.Failure;
                transaction.Message = ex.Message;
            }

            return(transaction);
        }
        public async Task <GetAllRouletteResult> GetAll()
        {
            var r    = new GetAllRouletteResult();
            var data = await _rouletteRepository.GetAllRoulette();

            r.Data = data;
            return(r);
        }