//删除博客 static void Delete() { BlogBusinessLayerss bbl = new BlogBusinessLayerss(); Console.WriteLine("请输入一个博客ID"); int id = int.Parse(Console.ReadLine()); Blog blog = bbl.Query(id); bbl.Delete(blog); }
static void QueryBlog() { BlogBusinessLayerss bbl = new BlogBusinessLayerss(); var blogs = bbl.Query(); foreach (var item in blogs) { Console.WriteLine(item.BlogId + "" + item.Name); } }
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); } }
//修改博客 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); }
static void CheckPostID(int blogID) { BlogBusinessLayerss bbl = new BlogBusinessLayerss(); Blog blog = bbl.Query(blogID); if (blog == null) { Console.WriteLine("没有此博客"); opBlog(); } else { return; } }