Esempio n. 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);
        }
Esempio n. 2
0
 public static EditablePost GetPostByID(int id)
 {
     return(EditablePostProvider.Posts().SingleOrDefault(p => p.PostID == id));
 }
Esempio n. 3
0
 public static IEnumerable GetChildPosts(int id)
 {
     return(EditablePostProvider.Posts().Where(p => p.ParentID == id));
 }
Esempio n. 4
0
 public static IEnumerable GetPosts()
 {
     return(EditablePostProvider.Posts());
 }