public List <AllAboutPost> GetAllPostInformationByID(int signupId) { List <AllAboutPost> allAboutPosts = new List <AllAboutPost>(); List <PostInfo> postInfos = notificationGateway.GetAllPostInformationByID(signupId); foreach (PostInfo info in postInfos) { AllAboutPost allAboutPost = new AllAboutPost(); allAboutPost.Id = info.Id; allAboutPost.SignUpID = info.SignUpID; allAboutPost.Name = GetPersonInformation(signupId).Name; allAboutPost.NoOfLike = NumberOfPostLike(info.Id).Count; allAboutPost.PostDetail = info.PostDetail; allAboutPost.DateTime = info.DateTime; allAboutPost.PostPhotoInByte = info.PostPhotoInByte; if (info.PostPhotoInByte != null) { allAboutPost.PostPhotoInString = Convert.ToBase64String(info.PostPhotoInByte); } allAboutPost.ProfilePhotoInByte = GetProfilePhotoByID(signupId).PhotoInByte; if (GetProfilePhotoByID(signupId).PhotoInByte != null) { allAboutPost.ProfilePhotoInString = Convert.ToBase64String(GetProfilePhotoByID(signupId).PhotoInByte); } allAboutPosts.Add(allAboutPost); } allAboutPosts = allAboutPosts.OrderByDescending(e => e.DateTime).OrderByDescending(e => e.DateTime).ToList(); return(allAboutPosts); }
public List <PostInfo> GetAllPostPhotoByID(int signupId) { List <PostInfo> postInfos = notificationGateway.GetAllPostInformationByID(signupId); List <PostInfo> newPostInfos = new List <PostInfo>(); foreach (PostInfo postInfo in postInfos) { if (postInfo.PostPhotoInString != null) { newPostInfos.Add(postInfo); } } return(newPostInfos); }