Exemplo n.º 1
0
        public async Task <ActionResult <IEnumerable <string> > > Get()
        {
            var query = new GetAllUserQuestionsQuery()
            {
                User = "******"
            };
            var result = await _queryDispatcher.DispatchAsync(query).ConfigureAwait(false);

            return(Ok(result));
        }
Exemplo n.º 2
0
        public async Task <IDictionary <Guid, string> > HandleAsync(GetAllUserQuestionsQuery query)
        {
            var streamId    = $"{StreamPrefix.Question}_{query.User}";
            var aggregation = await _connectionProvider.Dispatch <AllQuestionByUserProjection, QuestionTeasersWith100CharactersState>(streamId).ConfigureAwait(false);

            if (!aggregation.Any())
            {
                return(new Dictionary <Guid, string>());
            }
            return(aggregation.ToDictionary((k) => new Guid(k.Key), (v) => v.Value.Questions));
        }