//修改 static void UpdatePosts() { QueryBlog(); BlogBusinessLayera bbl = new BlogBusinessLayera(); 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() { BlogBusinessLayera bbl = new BlogBusinessLayera(); 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); }