예제 #1
0
        static void Delete()
        {
            BlogBusinessLayera bbl = new BlogBusinessLayera();

            Console.WriteLine("请输入id");
            int  id   = int.Parse(Console.ReadLine());
            Blog blog = bbl.Query(id);

            bbl.Delete(blog);
        }
예제 #2
0
        static void QueryBlog()
        {
            BlogBusinessLayera bbl = new BlogBusinessLayera();
            var blogs = bbl.Query();

            foreach (var itme in blogs)
            {
                Console.WriteLine(itme.BlogId + "" + itme.Name);
            }
        }
예제 #3
0
        static void Update()
        {
            Console.WriteLine("请输入id");
            int id = int.Parse(Console.ReadLine());
            BlogBusinessLayera bbl = new BlogBusinessLayera();
            Blog blog = bbl.Query(id);

            Console.WriteLine("请输入新名");
            string name = Console.ReadLine();

            blog.Name = name;
            bbl.Update(blog);
        }
예제 #4
0
        static void DisplayPosts(int blogId)
        {
            {
                BlogBusinessLayera bbl = new BlogBusinessLayera();
                Blog blog = bbl.Query(blogId);

                List <Post> postList = bbl.PostQuery(blogId);
                foreach (var item in postList)
                {
                    Console.WriteLine("--博客ID:{0}--  ---帖子题目:{1}--  ---帖子内容:{2}--  ---帖子ID:{3}--", item.BlogId, item.Title, item.Content, item.PostId);
                }
            }
        }