Esempio n. 1
0
        public static void CreateOneComment(MyStoryContext dbContext)
        {
            var comment = new Comment
            {
                Content = CommentContent,
                DateCreated = DateTime.Now,
                PostId = 1,
                CommenterId = 1,
            };

            dbContext.Comments.Add(comment);
            dbContext.SaveChanges();
        }
Esempio n. 2
0
        public static void CreateOnePost(MyStoryContext dbContext)
        {
            var blogId = dbContext.Blogs.SingleOrDefault().Id;

            dbContext.Posts.Add(new Post
            {
                Id = 1,
                BlogId = blogId,
                Content = PostContent,
                DateCreated = DateTime.Now,
                DateModified = DateTime.Now,
                Title = PostTitle,
                LocationOfWriting = new Location()
            });

            dbContext.SaveChanges();
        }
Esempio n. 3
0
 public static void CreateAccountAndBlog(MyStoryContext dbContext)
 {
     dbContext.Blogs.Add(new Blog
                     {
                         Title = BlogTitle,
                         BlogOwner = new Account
                                     {
                                         Email = AccountEmail,
                                         Password = AccountPasword,
                                         Name = AccountName
                                     }
                     });
     dbContext.SaveChanges();
 }
Esempio n. 4
0
        public static void CreateOneCommenter(MyStoryContext dbContext)
        {
            var commenter = new Commenter
            {
                Id = 1,
                Name = CommenterName,
                Email = CommenterEmail
            };

            dbContext.Commenters.Add(commenter);
            dbContext.SaveChanges();
        }