コード例 #1
0
        public static List <EditablePost> GetEditablePosts(bool actualizeDates = false)
        {
            List <EditablePost> posts = (List <EditablePost>)HttpContext.Current.Session["Posts"];

            if (posts == null)
            {
                posts = EditablePostProvider.Posts().ToList();

                var postLookups = posts.Select(p => new PostLookup(p.PostID, p.From));

                foreach (EditablePost post in posts)
                {
                    IEnumerable <PostLookup> filteredPostLookups = postLookups.Where(l => l.PostId != post.PostID);
                    post.PostLookups.AddRange(filteredPostLookups);
                }

                if (actualizeDates)
                {
                    ActualizeDates(posts);
                }
                HttpContext.Current.Session["Posts"] = posts;
            }
            return(posts);
        }
コード例 #2
0
 public static EditablePost GetPostByID(int id)
 {
     return(EditablePostProvider.Posts().SingleOrDefault(p => p.PostID == id));
 }
コード例 #3
0
 public static IEnumerable GetChildPosts(int id)
 {
     return(EditablePostProvider.Posts().Where(p => p.ParentID == id));
 }
コード例 #4
0
 public static IEnumerable GetPosts()
 {
     return(EditablePostProvider.Posts());
 }