コード例 #1
0
        //删除博客
        static void Delete()
        {
            BlogBusinessLayerss bbl = new BlogBusinessLayerss();

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

            bbl.Delete(blog);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Muller25-13/BgHomework
        static void QueryBlog()
        {
            BlogBusinessLayerss bbl = new BlogBusinessLayerss();
            var blogs = bbl.Query();

            foreach (var item in blogs)
            {
                Console.WriteLine(item.BlogId + "" + item.Name);
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Muller25-13/BgHomework
        static void DisplayPosts(int blogID)
        {
            BlogBusinessLayerss bbl = new BlogBusinessLayerss();
            Blog blog = bbl.Query(blogID);

            List <Post> postList = bbl.pQuery(blogID);

            foreach (var item in postList)
            {
                Console.WriteLine("博客ID:{0}  ---  帖子题目:{1}  ---  帖子内容:{2}  ---帖子ID:{3}", item.BlogId, item.Title, item.Content, item.PostId);
            }
        }
コード例 #4
0
        //修改博客
        static void Update()
        {
            Console.WriteLine("请输入id");
            int id = int.Parse(Console.ReadLine());
            BlogBusinessLayerss bbl = new BlogBusinessLayerss();
            Blog blog = bbl.Query(id);

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

            blog.Name = name;
            bbl.Update(blog);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: Muller25-13/BgHomework
        static void CheckPostID(int blogID)
        {
            BlogBusinessLayerss bbl = new BlogBusinessLayerss();

            Blog blog = bbl.Query(blogID);

            if (blog == null)
            {
                Console.WriteLine("没有此博客");

                opBlog();
            }
            else
            {
                return;
            }
        }