//删除帖子 static void DeletePost() { BloBussinessLayer bbl = new BloBussinessLayer(); Console.WriteLine("请输入要删除的帖子:"); int id = int.Parse(Console.ReadLine()); Post post = bbl.Querypost(id); bbl.Delete(post); }
//删除 static void Delete() { BloBussinessLayer bbl = new BloBussinessLayer(); Console.WriteLine("请输入id"); int id = int.Parse(Console.ReadLine()); ClassName CN = bbl.Query(id); bbl.Delete(CN); }
//显示全部博客 static void QueryClassName() { BloBussinessLayer bbl = new BloBussinessLayer(); var ClassNames = bbl.Query(); foreach (var item in ClassNames) { Console.Write(item.ClassNameId + " "); Console.WriteLine(item.Name); } }
//增加 static void createClassName() { Console.WriteLine("输入一个班级名称"); string name = Console.ReadLine(); ClassName CN = new ClassName(); CN.Name = name; BloBussinessLayer bbl = new BloBussinessLayer(); bbl.Add(CN); }
//显示全部博客 static void QueryBlog() { BloBussinessLayer bbl = new BloBussinessLayer(); var blogs = bbl.Query(); foreach (var item in blogs) { Console.Write(item.BlogId + " "); Console.WriteLine(item.Name); } }
//增加--交互 static void createBlog() { Console.WriteLine("请输入一个博客名称"); string name = Console.ReadLine(); Blog blog = new Blog(); blog.Name = name; BloBussinessLayer bbl = new BloBussinessLayer(); bbl.Add(blog); }
//更新 static void Update() { Console.WriteLine("请输入ID:"); int id = int.Parse(Console.ReadLine()); BloBussinessLayer bbl = new BloBussinessLayer(); ClassName CN = bbl.Query(id); Console.WriteLine("请输入新名字:"); string name = Console.ReadLine(); CN.Name = name; bbl.Update(CN); }
//新增帖子 static void createPost(int blogId) { Console.WriteLine("请创建新帖子:"); string title = Console.ReadLine(); Console.WriteLine("请输入帖子的内容"); string content = Console.ReadLine(); Post post = new Post(); post.BlogId = blogId; post.Title = title; post.Content = content; BloBussinessLayer bbl = new BloBussinessLayer(); bbl.Add(post); }
//更新帖子 static void UpdatePost() { Console.WriteLine("输入帖子Id:"); int id = int.Parse(Console.ReadLine()); BloBussinessLayer bbl = new BloBussinessLayer(); Post post = bbl.Querypost(id); Console.WriteLine("输入新的帖子:"); string content = Console.ReadLine(); string title = Console.ReadLine(); //int blogId = int.Parse(Console.ReadLine()); //post.BlogId = blogId; post.Title = title; post.Content = content; bbl.Update(post); }