コード例 #1
0
        public override async Task <GetDictionaryByIdRequest> HandleAsync(GetDictionaryByIdRequest command, CancellationToken cancellationToken = new CancellationToken())
        {
            var dictionaryView = _dictionaryRenderer.Render(await _queryProcessor.ExecuteAsync(new GetDictionaryByIdQuery {
                Id = command.DictioaryId
            }, cancellationToken));
            var localDictionary = await _queryProcessor.ExecuteAsync(new GetLocalDictionaryQuery { DictionaryId = dictionaryView.Id }, cancellationToken);

            dictionaryView.IsOffline = localDictionary != null;
            command.Result           = dictionaryView;
            return(await base.HandleAsync(command, cancellationToken));
        }
コード例 #2
0
        public DictionariesView Render(DictionariesModel source)
        {
            var links = new List <LinkView>
            {
                LinkRenderer.RenderOrReRoute(source.Links, "GetDictionaries", RelTypes.Self)
            };


            var view = source.Map <DictionariesModel, DictionariesView>();

            view.Links = links;
            view.Items = source.Items.Select(d => _dictionaryRenderer.Render(d));
            return(view);
        }