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 <AllAboutPost> GetPostInformation(int id) { List <int> idList = homeGateway.GetAllFriendList(id); List <PostInfo> postInfos = homeGateway.GetPostInformation(idList); List <AllAboutPost> allAboutPosts = new List <AllAboutPost>(); foreach (PostInfo info in postInfos) { AllAboutPost allAboutPost = new AllAboutPost(); allAboutPost.Id = info.Id; allAboutPost.SignUpID = info.SignUpID; allAboutPost.Name = GetPersonInformation(info.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(info.SignUpID).PhotoInByte; if (GetProfilePhotoByID(info.SignUpID).PhotoInByte != null) { allAboutPost.ProfilePhotoInString = Convert.ToBase64String(GetProfilePhotoByID(info.SignUpID).PhotoInByte); } allAboutPosts.Add(allAboutPost); } allAboutPosts = allAboutPosts.OrderByDescending(e => e.DateTime).OrderByDescending(e => e.DateTime).ToList(); //postInfos = (from e in postInfos // orderby e.DateTime, e.DateTime // select e).ToList(); return(allAboutPosts); }