Exemple #1
0
        public override async Task <GetTranslationsForWordRequest> HandleAsync(GetTranslationsForWordRequest command, CancellationToken cancellationToken = new CancellationToken())
        {
            var query = new GetTranslationsByWordIdQuery {
                DictionaryId = command.DictionaryId, WordId = command.WordId
            };
            var result = await _queryProcessor.ExecuteAsync(query, cancellationToken);

            command.Result = result.Select(t => _translationRenderer.Render(t, command.DictionaryId));

            return(await base.HandleAsync(command, cancellationToken));
        }
        public override async Task <GetTranslationByIdRequest> HandleAsync(GetTranslationByIdRequest command, CancellationToken cancellationToken = new CancellationToken())
        {
            var query = new GetTranslationByIdQuery
            {
                DictionaryId = command.DictionaryId, TranslationId = command.TranslationId
            };
            var result = await _queryProcessor.ExecuteAsync(query, cancellationToken);

            command.Result = _translationRenderer.Render(result, command.DictionaryId);

            return(await base.HandleAsync(command, cancellationToken));
        }