示例#1
0
        public async Task <IActionResult> GetAsync(Guid id)
        {
            var deck = await decksService.GetAsync(id);

            var cards = await Task.WhenAll(deck.CardsIds
                                           .Select(cardId => cardsService.GetAsync(cardId)));

            return(Ok(new DeckModel
            {
                Id = deck.Id,
                Name = deck.Name,
                Cards = cards
                        .ToList()
            }));
        }