public VehicleRepository(VegaDbContext context)
 {
     this.context = context;
 }
예제 #2
0
 public PhotoRepository(VegaDbContext context)
 {
     this.context = context;
 }
예제 #3
0
 public UnitOfWork(VegaDbContext context)
 {
     this.context = context;
 }
예제 #4
0
        public static void Initialize(VegaDbContext dbContext)
        {
            dbContext.Database.EnsureCreated();

            if (dbContext.Makes.Any())
            {
                return;
            }

            var modelList1 = new List <Model> {
                new Model {
                    Name = "E350"
                },
                new Model {
                    Name = "E220"
                },
                new Model {
                    Name = "SLA 120"
                },
                new Model {
                    Name = "C180"
                },
            };


            var modelList2 = new List <Model> {
                new Model {
                    Name = "C5"
                },
                new Model {
                    Name = "C4"
                },
                new Model {
                    Name = "C3"
                }
            };

            modelList1.ForEach(m => dbContext.Models.Add(m));
            modelList2.ForEach(m => dbContext.Models.Add(m));

            var makeList = new List <Make> {
                new Make {
                    Name = "Mercedes-Benz", Models = modelList1
                },
                new Make {
                    Name = "Citroen", Models = modelList2
                }
            };

            makeList.ForEach(m => dbContext.Makes.Add(m));

            var featureList = new List <Feature> {
                new Feature {
                    Name = "Feature 1"
                },
                new Feature {
                    Name = "Feature 2"
                },
                new Feature {
                    Name = "Feature 3"
                },
            };

            featureList.ForEach(f => dbContext.Features.Add(f));

            dbContext.SaveChanges();
        }
예제 #5
0
 public UnitOfWork(VegaDbContext context)
 {
     _context = context;
 }