Exemplo n.º 1
0
        public void run(PtiContext context)
        {
            if (context.Test.Any())
            {
                return;   // DB has been seeded
            }

            var rows = new Test[]
            {
                new Test {
                    Title = "title1", Sort = 0, Active = 1, Created_at = DateTime.Now, Updated_at = DateTime.Now
                },
                new Test {
                    Title = "title2", Sort = 0, Active = 1, Created_at = DateTime.Now, Updated_at = DateTime.Now
                },
            };

            foreach (Test row in rows)
            {
                context.Test.Add(row);

                var test2 = new Test2 {
                    Title = "test", Sort = 0, Active = 1, Created_at = DateTime.Now, Updated_at = DateTime.Now, Test = row
                };
                context.Test2.Add(test2);
            }

            context.SaveChanges();
        }
Exemplo n.º 2
0
 public GenericRepository(PtiContext context)
 {
     this.context = context;
 }
Exemplo n.º 3
0
 public ExampleRepository(PtiContext context) : base(context)
 {
 }
Exemplo n.º 4
0
 public HomeController(PtiContext context)
 {
     _context = context;
 }
Exemplo n.º 5
0
        public static void Initialize(PtiContext context)
        {
            TestSeed test = new TestSeed();

            test.run(context);
        }