/// <summary> /// Get the file list. /// </summary> /// <param name="activityId">the activity id</param> /// <returns></returns> private async Task <FilesViewData> GetFiles(int activityId) { ActivityFileResultData activityFileResultData = await WebApiClient.GetAsync <ActivityFileResultData>(Constant.WebApiControllerActivities, Constant.WebApiActivityFileList); List <FileViewData> activityfileList = new List <FileViewData>(); foreach (var activityFileDto in activityFileResultData.ActivityFileDtoList) { FileViewData activityfile = new FileViewData { TranslationsList = new List <ActivityFileTranslationItemData>(), File = activityFileDto }; if (activityFileDto.ActivityId == activityId) { activityfile.TranslationsList = await GetFileTranslations(activityFileDto.ActivityFileId); activityfileList.Add(activityfile); } } FilesViewData filesViewData = new FilesViewData { Files = activityfileList }; return(filesViewData); }
/// <summary> /// Get the paragraphe of the section. /// </summary> /// <returns></returns> private async Task <FilesViewData> GetFiles(int sectionId) { SectionFileRequestData findSectionFileRequestData = new SectionFileRequestData { SectionFileDto = new SectionFileItemData { SectionId = sectionId }, FindSectionFileDto = FindSectionFileItemData.SectionId }; SectionFileResultData sectionFileResultData = await WebApiClient.PostFormJsonAsync <SectionFileRequestData, SectionFileResultData>( Constant.WebApiControllerAbout, Constant.WebApiFindSectionFiles, findSectionFileRequestData); List <FileViewData> filesList = new List <FileViewData>(); if (sectionFileResultData != null && sectionFileResultData.OperationSuccess && sectionFileResultData.SectionFileDtoList != null) { foreach (var fileDto in sectionFileResultData.SectionFileDtoList) { FileViewData file = new FileViewData { TranslationsList = new List <SectionFileTranslationItemData>(), File = fileDto }; file.TranslationsList = await GetFileTranslations(fileDto.SectionFileId); filesList.Add(file); } } FilesViewData filesViewData = new FilesViewData { Files = filesList }; return(filesViewData); }