Пример #1
0
        private async Task <SessionStateDto> InitializeAsync(Guid userId, string deck)
        {
            var cards = await _cardsQueryService.GetListAsync(deck);

            var sessionCards = cards.Select(x => new SessionCardDto(x.Id, x.Title, x.Answer, x.Question)).ToList();
            var sessionState = new SessionStateDto(userId, deck, sessionCards.Count);

            sessionState.SetCard(sessionCards.First());
            _cache.Set(GetSessionStateKey(userId, deck), sessionState, TimeSpan.FromHours(1));
            _cache.Set(GetSessionCardsKey(sessionState.Id), sessionCards, TimeSpan.FromHours(1));

            return(sessionState);
        }
Пример #2
0
 public async Task <IActionResult> Get(string topic, string category, string deck)
 => Ok(await _cardsQueryService.GetListAsync(deck));