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