public async Task <ICollection <PostFile> > GetPostImages(AttachmentData attachments, string postId) { var fileList = new List <PostFile>(); var arrayOfImages = attachments.Subattachments?.Data ?? new List <SubAttachmentData>(); if (arrayOfImages.Count == 0) { var mainImage = attachments.Media?.Image; if (mainImage != null) { arrayOfImages.Add(new SubAttachmentData { Media = new Media { Image = mainImage } }); } } foreach (var image in arrayOfImages) { var info = await GetFileInfo(image, postId); if (info != null) { fileList.Add(FileMapper.ConvertToPostFile(info)); } } return(fileList); }
public async Task <ICollection <PostFile> > GetPostImages(IList <SharepointPostImages> attachments, int postId) { var fileList = new List <PostFile>(); foreach (var image in attachments) { var info = await GetFileInfo(image, postId); fileList.Add(FileMapper.ConvertToPostFile(info)); } return(fileList); }