Пример #1
0
        private SectionViewData BuildSectionViewData(Section section)
        {
            var sectionViewData = new SectionViewData(section);
            var module          = _moduleLoader.GetModuleFromSection(section);

            if (module is IActionProvider)
            {
                sectionViewData.OutboundActions = ((IActionProvider)module).GetOutboundActions();
            }
            if (module is IActionConsumer)
            {
                sectionViewData.InboundActions = ((IActionConsumer)module).GetInboundActions();
            }
            return(sectionViewData);
        }
Пример #2
0
        /// <summary>
        /// Get the sections list.
        /// </summary>
        /// <returns></returns>
        private async Task <SectionViewData> GetSections(int sectionId)
        {
            SectionViewData    sectionViewData = new SectionViewData();
            SectionRequestData request         = new SectionRequestData
            {
                SectionDto = new SectionItemData {
                    SectionId = sectionId
                },
                FindSectionDto = FindSectionItemData.SectionId
            };
            SectionResultData result =
                await WebApiClient.PostFormJsonAsync <SectionRequestData, SectionResultData>(
                    Constant.WebApiControllerAbout, Constant.WebApiFindSections, request);

            if (result != null && result.OperationSuccess && result.SectionDto != null)
            {
                SectionTranslationRequestData findSectionTranslationRequest = new SectionTranslationRequestData()
                {
                    SectionTranslationDto = new SectionTranslationItemData {
                        SectionId = sectionId
                    },
                    FindSectionTranslationDto = FindSectionTranslationItemData.SectionId
                };
                SectionTranslationResultData resultSectionTranslation =
                    await WebApiClient.PostFormJsonAsync <SectionTranslationRequestData, SectionTranslationResultData>(
                        Constant.WebApiControllerAbout, Constant.WebApiFindSectionTranslations,
                        findSectionTranslationRequest);

                if (resultSectionTranslation != null && resultSectionTranslation.OperationSuccess && resultSectionTranslation.SectionTranslationDtoList != null)
                {
                    sectionViewData.SectionTranslationsList = resultSectionTranslation.SectionTranslationDtoList
                                                              .Where(s => s.LanguageId == _lang).ToList();
                    sectionViewData.Section = result.SectionDto;
                }
            }
            return(sectionViewData);
        }