Example #1
0
        public void displayPost(int choice)
        {
            //have a diffrent option for displaying for each choice, i can probably use the query thing to get all blogs
            //set choice to blog id but if they choose to display all posts set choice to something else, as the number of blogs will increase
            if (choice == -1)
            {
                var query = Posts.OrderBy(b => b.Title);

                Console.WriteLine("All posts in the database:");
                foreach (var item in query)
                {
                    item.displayPost();
                }
            }
            var query2 = Blogs.OrderBy(b => b.BlogId);

            foreach (var item in query2)
            {
                if (item.BlogId == choice)
                {
                    Posts.Find(choice); //i need a way to display this
                }
            }
        }
        public IEnumerable <Blog> PaginatedBlogs()
        {
            int start = (CurrentPage - 1) * BlogPerPage;

            return(Blogs.OrderBy(b => b.Id).Skip(start).Take(BlogPerPage));
        }