private static void CreatePost(DataContext dataContext, Blog blog) { Console.Write("Title: "); var title = Console.ReadLine(); Console.Write("Content: "); var content = Console.ReadLine(); Console.Write("Angst Level: "); var angst = Console.ReadLine(); blog.Posts.Add(new Post { Title = title, Content = content, AngstLevel = angst, Posted = DateTime.Now, }); dataContext.SaveChanges(); }
private static void CreateBlog(DataContext dataContext) { Console.Write("Blog name: "); var name = Console.ReadLine(); Console.Write("Your name: "); var author = Console.ReadLine(); dataContext.Blogs.Add(new Blog { Name = name, Author = author, }); dataContext.SaveChanges(); }