Пример #1
0
        //更新贴子
        static void UpdatePost()
        {
            QueryBlog();
            BlogBusinessLayer  bbl = new BlogBusinessLayer();
            PostBussinessLayer pbl = new PostBussinessLayer();

            Console.WriteLine("请输入一个博客ID");
            int blogId = int.Parse(Console.ReadLine());

            DisplayPosts(blogId);
            Console.WriteLine("请输入修改的贴子ID");
            int  postId = int.Parse(Console.ReadLine());
            Post post   = pbl.QueryPost(postId);

            Console.WriteLine("请输入新标题");
            string newTitle = Console.ReadLine();

            post.Title = newTitle;
            Console.WriteLine("请输入新内容");
            string newContent = Console.ReadLine();

            post.Content = newContent;
            pbl.Update(post);
            DisplayPosts(blogId);
        }
Пример #2
0
        //删除贴子
        static void DeletePost()
        {
            QueryBlog();
            BlogBusinessLayer  bbl = new BlogBusinessLayer();
            PostBussinessLayer pbl = new PostBussinessLayer();

            Console.WriteLine("请输入一个博客ID");
            int id = int.Parse(Console.ReadLine());

            DisplayPosts(id);
            Console.WriteLine("请输入删除的贴子");
            int  postId = int.Parse(Console.ReadLine());
            Post post   = pbl.QueryPost(postId);

            pbl.DeletePost(post);
            DisplayPosts(id);
        }
Пример #3
0
        static void UpdatePost()
        {
            QueryBlog();
            int blogId = GetBlogId();

            DisplatPosts(blogId);
            Console.WriteLine("请输入要更改的帖子Id");
            int id = int.Parse(Console.ReadLine());
            PostBussinessLayer pbl = new PostBussinessLayer();
            Post post = pbl.QueryPost(id);

            Console.WriteLine("请输入新标题");
            string title = Console.ReadLine();

            Console.WriteLine("请输入新的内容");
            string content = Console.ReadLine();

            post.Title   = title;
            post.Content = content;
            pbl.Update(post);
            DisplatPosts(blogId);
        }