static void UpdatePosts() { QueryBlog(); BlogBusinessLayerss bbl = new BlogBusinessLayerss(); Console.WriteLine("请输入一个博客ID"); int blogID = int.Parse(Console.ReadLine()); DisplayPosts(blogID); Console.WriteLine("请输入要修改的帖子ID"); int postID = int.Parse(Console.ReadLine()); Post post = bbl.postQuery(postID); Console.WriteLine("请输入新题目"); string newTitle = Console.ReadLine(); post.Title = newTitle; Console.WriteLine("请输入新内容"); string newContent = Console.ReadLine(); post.Content = newContent; bbl.pUpdate(post); DisplayPosts(blogID); }
//删除帖子 static void DeletePosts() { BlogBusinessLayerss bbl = new BlogBusinessLayerss(); Console.WriteLine("请输入一个博客ID"); int blogID = int.Parse(Console.ReadLine()); DisplayPosts(blogID); Console.WriteLine("请输入要删除的帖子ID"); int postID = int.Parse(Console.ReadLine()); Post post = bbl.postQuery(postID); bbl.DeletePost(post); DisplayPosts(blogID); }