Example #1
0
        private void PopulateDb(CodeUnderflowDbContext db)
        {
            db.Tags.Add(new Tag()
            {
                Title     = "Tag1",
                Questions = new List <QuestionTag>()
                {
                    new QuestionTag()
                    {
                    },
                    new QuestionTag()
                    ,
                    new QuestionTag()
                }
            });

            db.Tags.Add(new Tag()
            {
                Title     = "Tag2",
                Questions = new List <QuestionTag>()
                {
                    new QuestionTag()
                    ,
                    new QuestionTag()
                }
            });

            db.Tags.Add(new Tag()
            {
                Title     = "Tag3",
                Questions = new List <QuestionTag>()
                {
                    new QuestionTag()
                }
            });

            db.SaveChanges();
        }
Example #2
0
        private void PopulateDb(CodeUnderflowDbContext db)
        {
            db.Users.Add(new User()
            {
                Id = "user1"
            });
            db.Users.Add(new User()
            {
                Id = "user2"
            });
            db.Users.Add(new User()
            {
                Id        = "user3",
                IsDeleted = true
            });
            db.Users.Add(new User()
            {
                Id        = "user4",
                IsDeleted = true
            });

            db.SaveChanges();
        }
        private void PopulateDb(CodeUnderflowDbContext db)
        {
            db.Answers.Add(new Answer()
            {
                Id         = 1,
                Content    = "Content1",
                QuestionId = 11,
                AuthorId   = "asd1",
                PostDate   = DateTime.UtcNow,
                Votes      = 10
            });

            db.Answers.Add(new Answer()
            {
                Id         = 2,
                Content    = "Content2",
                QuestionId = 12,
                AuthorId   = "asd2",
                PostDate   = DateTime.UtcNow,
                Votes      = 12
            });
            db.Answers.Add(new Answer()
            {
                Id         = 3,
                Content    = "Content3",
                QuestionId = 13,
                AuthorId   = "asd3",
                PostDate   = DateTime.UtcNow,
                Votes      = 13
            });
            db.Answers.Add(new Answer()
            {
                Id         = 4,
                Content    = "Content4",
                QuestionId = 14,
                AuthorId   = "asd4",
                PostDate   = DateTime.UtcNow,
                Votes      = 14
            });

            db.Answers.Add(new Answer()
            {
                Id         = 5,
                Content    = "Content5",
                QuestionId = 15,
                AuthorId   = "asd5",
                PostDate   = DateTime.UtcNow,
                Votes      = 15
            });
            db.Answers.Add(new Answer()
            {
                Id         = 6,
                Content    = "Content6",
                QuestionId = 16,
                AuthorId   = "asd6",
                PostDate   = DateTime.UtcNow,
                Votes      = 16
            });

            db.SaveChanges();
        }
        private void PopulateDb(CodeUnderflowDbContext db)
        {
            db.Questions.Add(new Question()
            {
                Title = "Question1",
                Votes = new List <Vote>()
                {
                    new Vote()
                },
                Tags = new List <QuestionTag>()
                {
                    new QuestionTag()
                    {
                        Tag = new Tag()
                        {
                            Title = "Tag1"
                        }
                    }
                }
            });
            db.Questions.Add(new Question()
            {
                Title = "Question2",
                Votes = new List <Vote>()
                {
                    new Vote()
                },
                Tags = new List <QuestionTag>()
                {
                    new QuestionTag()
                    {
                        Tag = new Tag()
                        {
                            Title = "Tag1"
                        }
                    },
                    new QuestionTag()
                    {
                        Tag = new Tag()
                        {
                            Title = "Tag2"
                        }
                    }
                }
            });
            db.Questions.Add(new Question()
            {
                Title = "Question3",
                Votes = new List <Vote>()
                {
                    new Vote()
                },
                Tags = new List <QuestionTag>()
                {
                    new QuestionTag()
                    {
                        Tag = new Tag()
                        {
                            Title = "Tag1"
                        }
                    },
                    new QuestionTag()
                    {
                        Tag = new Tag()
                        {
                            Title = "Tag2"
                        }
                    },
                    new QuestionTag()
                    {
                        Tag = new Tag()
                        {
                            Title = "Tag3"
                        }
                    }
                }
            });

            db.SaveChanges();
        }