public IList <Comment> GetCommentsByUserId(int id) { var list = this.GetAll(); PostDataAccess postList = new PostDataAccess(); var ListOfPosts = postList.GetPostsByUserId(id); return(list.Join(ListOfPosts, comment => comment.Id, post => post.Id, (comment, post) => comment).ToList()); }
public IList <Comment> GetCommentsByUserId(int id) { PostDataAccess postsl = new PostDataAccess(); var post = postsl.GetPostsByUserId(id); var list = this.GetAll(); var result = from x in list join y in post on x.PostId equals y.Id select x; return(result.ToList()); }