Ejemplo n.º 1
0
        public async Task <Guid> HandleAsync(CreateQuestion command)
        {
            var questionId = Guid.NewGuid();

            var questionStreamId = $"{StreamPrefix.Question}_{command.CreatedOn}";

            await _eventStoreConnectionProvider.Execute <QuestionState>(questionStreamId, s => QuestionActions.Create(s, questionId, command.Question));

            await _eventStoreConnectionProvider.Execute <QuestionState>(questionStreamId, s => TagActions.Create(s, questionId, command.Tag));


            return(questionId);
        }
Ejemplo n.º 2
0
        public async Task <Guid> HandleAsync(CreateTag command)
        {
            var streamId = $"{StreamPrefix.Question}_{command.User}";
            await _eventStoreConnectionProvider.Execute <QuestionState>(streamId, s => TagActions.Create(s, command.QuestionId, command.TagName));

            return(command.QuestionId);
        }
Ejemplo n.º 3
0
        public async Task <Guid> HandleAsync(CreateAnswer command)
        {
            var id = Guid.NewGuid();
            var questionStreamId = $"{StreamPrefix.Question}_{command.CreatedBy}";
            await _eventStoreConnectionProvider.Execute <QuestionState>(questionStreamId, s => QuestionActions.Create(s, command.QuestionId, id, command.Answer, command.IsCorrect));

            return(id);
        }