Пример #1
0
        async public Task <ShortDeckInfo> Post(DeckCreate creation)
        {
            int  creationCount = creation.Count.HasValue ? creation.Count.Value : 1;
            Deck deck          = await _repository.CreateNewShuffledDeckAsync(creationCount);

            ShortDeckInfo deckInfo = new ShortDeckInfo
            {
                DeckId    = deck.DeckId,
                Remaining = deck.Cards.Where(x => !x.Drawn).Count()
            };

            return(deckInfo);
        }
Пример #2
0
        public async Task <ShortDeckInfo> Post(DeckCreate model)
        {
            int count = model.Count.HasValue ? model.Count.Value : 1;
            var deck  = await repository.CreateNewShuffledDeckAsync(count);

            var deckInfo = new ShortDeckInfo()
            {
                DeckId    = deck.DeckId,
                Remaining = deck.Cards.Where(card => !card.Drawn).Count()
            };

            return(deckInfo);
        }