Esempio n. 1
0
        public async Task <TranslatedPageDto> MapPageDtoToTranslatedAsync(PageDto pageDto, IEnumerable <PageActionDto> pageActions, IEnumerable <PageContentDto> pageContents)
        {
            var translatedPage = new TranslatedPageDto();

            translatedPage.PageId = pageDto.PageId;
            translatedPage.Image  = pageDto.Image;
            translatedPage.Title  = pageDto.Title;

            var gameActions = await _pageActionPersistenceFactory.MapDtoToGameActionAsync(pageActions);

            var translatedContents = await _pageContentPersistenceFactory.MapPageContentDtoToTextSpanAsync(pageContents);

            translatedPage.PageActions       = gameActions;
            translatedPage.TranslatedContent = translatedContents;

            return(translatedPage);
        }
Esempio n. 2
0
        public async Task <PageVm> MapTranslatedPageDtoToPageVmAsync(TranslatedPageDto translatedPageDto)
        {
            return(await Task.Run(() =>
            {
                var pageVm = new PageVm();
                pageVm.Title = translatedPageDto.Title;
                pageVm.Image = translatedPageDto.Image;

                pageVm.Content = new List <Span>();

                var pageActions = _gameActionVmFactory.MapGameActionToVm(translatedPageDto.PageActions);
                pageVm.Actions = pageActions.ToList();

                var pageContents = _textSpanFactory.MapTextSpanToXamarinSpan(translatedPageDto.TranslatedContent);
                pageVm.Content = pageContents.ToList();

                return pageVm;
            }));
        }