Example #1
0
        /// <summary>
        /// Get the list of the paragraph
        /// </summary>
        /// <param name="activityId">the activity id</param>
        /// <returns></returns>
        private async Task <ParagraphsViewData> GetActivityParagraph(int activityId)
        {
            ActivityParagraphResultData activityParagraphResultData = await WebApiClient.GetAsync <ActivityParagraphResultData>(Constant.WebApiControllerActivities, Constant.WebApiActivityParagraphList);

            List <ParagraphViewData> activityparagraphList = new List <ParagraphViewData>();

            foreach (var activityParagraphDto in activityParagraphResultData.ActivityParagraphDtoList)
            {
                ParagraphViewData activityparagraph = new ParagraphViewData
                {
                    TranslationsList = new List <ActivityParagraphTranslationItemData>(),
                    Paragraph        = activityParagraphDto
                };

                if (activityParagraphDto.ActivityId == activityId)
                {
                    activityparagraph.TranslationsList = await GetActivityParagraphTranslation(activityParagraphDto.ParagraphId);

                    activityparagraphList.Add(activityparagraph);
                }
            }
            ParagraphsViewData paragraphsViewData = new ParagraphsViewData {
                Paragraphs = activityparagraphList
            };

            return(paragraphsViewData);
        }
Example #2
0
        /// <summary>
        /// Get the paragraphe of the section.
        /// </summary>
        /// <returns></returns>
        private async Task <ParagraphsViewData> GetParagraphs(int sectionId)
        {
            SectionParagraphRequestData findSectionParagraphRequestData = new SectionParagraphRequestData
            {
                SectionParagraphDto = new SectionParagraphItemData {
                    SectionId = sectionId
                },
                FindSectionParagraphDto = FindSectionParagraphItemData.SectionId
            };

            SectionParagraphResultData sectionParagraphResultData =
                await WebApiClient.PostFormJsonAsync <SectionParagraphRequestData, SectionParagraphResultData>(
                    Constant.WebApiControllerAbout, Constant.WebApiFindSectionParagraphs,
                    findSectionParagraphRequestData);

            ParagraphsViewData paragraphsViewData = new ParagraphsViewData
            {
                Paragraphs = new List <ParagraphViewData>()
            };
            List <ParagraphViewData> paragraphsList = new List <ParagraphViewData>();

            if (sectionParagraphResultData == null || !sectionParagraphResultData.OperationSuccess ||
                sectionParagraphResultData.SectionParagraphDtoList == null)
            {
                return(paragraphsViewData);
            }
            foreach (var paragraphDto in sectionParagraphResultData.SectionParagraphDtoList)
            {
                ParagraphViewData paragraph = new ParagraphViewData
                {
                    TranslationsList = new List <SectionParagraphTranslationItemData>(),
                    Paragraph        = paragraphDto
                };

                paragraph.TranslationsList = await GetParagraphTranslations(paragraphDto.ParagraphId);

                paragraphsList.Add(paragraph);
            }

            paragraphsViewData.Paragraphs = paragraphsList;
            return(paragraphsViewData);
        }