Пример #1
0
        private async Task <Deck> GetDeckAsync(Guid deckId)
        {
            var deck = await _deckRepository.GetByDeckByIdWithCardsAsync(deckId);

            if (deck == null)
            {
                throw new Exception("Deck not found or finished");
            }

            if (deck.Cards == null || deck.Cards.Count == 0)
            {
                throw new Exception("no more cards to withdraw");
            }

            return(deck);
        }