Exemplo n.º 1
0
        public async Task <WordsIdsByGameIdQueryResult> Handle(WordsIdsByGameQuery request,
                                                               CancellationToken cancellationToken = default)
        {
            IQueryable <int> wordsId     = context.WordsInGame(request.Id);
            List <int>       wordsIdList = await wordsId.ToListAsync(cancellationToken).ConfigureAwait(false);

            return(new WordsIdsByGameIdQueryResult
            {
                WordTranslationsList = wordsIdList
            });
        }
Exemplo n.º 2
0
        private IQueryable <UserWordPair> FindUserWordPairs(GameToUserQuery request)
        {
            // find words
            IQueryable <int> wordsId = context.WordsInGame(request.CreationId);

            // find user words
            IQueryable <int> userWords = UserWords(context.UserWordPairs, request.UserId);

            // exclude existing words
            wordsId = wordsId.Where(w => !userWords.Any(u => u.Equals(w)));

            return(SelectUserWordPairs(request, wordsId));;
        }