//删除贴子 static void DeletPost() { //显示博客列表 QueryBlog(); //用户选择某个博客(id) int blogID = GetBlogId(); //显示指定博客的帖子列表 DisplayPost(blogID); PostBusinessLayer pbl = new PostBusinessLayer(); Console.WriteLine("输入需要删除到贴子id"); int id = int.Parse(Console.ReadLine()); Post post = pbl.Query(id); pbl.Delete(post); Console.Clear(); selectPost(); }
/// <summary> /// 删除一个帖子 /// </summary> static void DeletePost() { //显示所有博客列表 QueryBlog(); BlogBusinessLayer bbl = new BlogBusinessLayer(); Console.WriteLine(" 请输入一个博客ID"); int blogID = int.Parse(Console.ReadLine()); DisplayBlogIdByPost(blogID); PostBusinessLayer pbl = new PostBusinessLayer(); Console.WriteLine("请输入一个帖子的id"); int postid = int.Parse(Console.ReadLine()); Post post = pbl.Query(postid); pbl.Delete(post); Console.WriteLine("删除成功!"); }