Ejemplo n.º 1
0
        public async Task <ActionResult> GetDeck()
        {
            bool isWork = await _gameSetService.SetDeck();

            GetDeckGameView cardModelList = await _gameSetService.GetDeck();

            return(View(cardModelList.Cards));
        }
Ejemplo n.º 2
0
        public async Task <GetDeckGameView> GetDeck()
        {
            var cardsViewModel = new GetDeckGameView();

            try
            {
                IEnumerable <Card> cardListCollection = await _cardRepository.GetAllAsync();

                foreach (var card in cardListCollection)
                {
                    cardsViewModel.Cards.Add(new DeckViewItem
                    {
                        Id    = card.Id,
                        Value = card.Value
                    });
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(cardsViewModel);
        }