示例#1
0
        public async Task <string> Seed()
        {
            int numberOfCars = 0;

            if (_context.Car.Count() == 0)
            {
                Car car1 = new Car {
                    Make = "Toyota", Model = "Corolla", Colour = "Blue", Year = 2011, VIN = 123
                };
                Car car2 = new Car {
                    Make = "Honda", Model = "Civic", Colour = "Red", Year = 2012, VIN = 456
                };
                Car car3 = new Car {
                    Make = "Nissan", Model = "Altima", Colour = "Green", Year = 2018, VIN = 789
                };
                Car car4 = new Car {
                    Make = "Mazda", Model = "Mazda3", Colour = "Silver", Year = 2010, VIN = 321
                };

                _context.AddRange(car1, car2, car3, car4);
                await _context.SaveChangesAsync();

                numberOfCars = 4;
            }

            return($"{numberOfCars} Cars Added");
        }
示例#2
0
        public async Task <string> Seed()
        {
            int numberOfMembers = 0;

            if (_context.Member.Count() == 0)
            {
                Member member1 = new Member {
                    FirstName = "Justin", LastName = "Hill", UserName = "******", Email = "*****@*****.**", Company = "IBM", Position = "Software Tester", BirthDate = DateTimeOffset.Now
                };
                Member member2 = new Member {
                    FirstName = "Devon", LastName = "Laslo", UserName = "******", Email = "*****@*****.**", Company = "Apple", Position = "JR Software Developer", BirthDate = DateTimeOffset.Now
                };
                Member member3 = new Member {
                    FirstName = "Max", LastName = "Vokey", UserName = "******", Email = "*****@*****.**", Company = "Google", Position = "Data Analyest", BirthDate = DateTimeOffset.Now
                };
                Member member4 = new Member {
                    FirstName = "Curtis", LastName = "Atlee", UserName = "******", Email = "*****@*****.**", Company = "Dell", Position = "Graphic Design Artist", BirthDate = DateTimeOffset.Now
                };

                _context.AddRange(member1, member2, member3, member4);
                await _context.SaveChangesAsync();

                numberOfMembers = 4;
            }

            return($"{numberOfMembers} Members Added");
        }
示例#3
0
        public async Task <string> Seed()
        {
            int numberOfCars = 0;

            if (_context.Car.Count() == 0)
            {
                Car car1 = new Car {
                    Make = "Acura", Model = "RLX", Year = 1992, VIN = 1542, Color = "Red"
                };
                Car car2 = new Car {
                    Make = "Audi", Model = "A8", Year = 2003, VIN = 538393, Color = "Black"
                };
                Car car3 = new Car {
                    Make = "Ford", Model = "Escape", Year = 1985, VIN = 0927848, Color = "Grey"
                };
                Car car4 = new Car {
                    Make = "BMW", Model = "8 Series", Year = 2017, VIN = 32, Color = "White"
                };

                _context.AddRange(car1, car2, car3, car4);
                await _context.SaveChangesAsync();

                numberOfCars = 4;
            }

            return($"{numberOfCars} Cars Added");
        }
示例#4
0
        public async Task <string> Seed()
        {
            int numberOfMembers = 0;

            if (_context.Member.Count() == 0)
            {
                Member mem1 = new Member {
                    UserName = "******", FirstName = "John", LastName = "Smith", Company = "Indigo", BirthDate = "1990-06-21", Email = "*****@*****.**", Position = "Senior Manager"
                };
                Member mem2 = new Member {
                    UserName = "******", FirstName = "Lily", LastName = "Rose", Company = "BMW", BirthDate = "1985-01-01", Email = "*****@*****.**", Position = "Sale Associate"
                };
                Member mem3 = new Member {
                    UserName = "******", FirstName = "Hanry", LastName = "Mac", Company = "Toyoto", BirthDate = "1995-07-28", Email = "*****@*****.**", Position = "Merchandise Manager"
                };
                Member mem4 = new Member {
                    UserName = "******", FirstName = "Nick", LastName = "Jackson", Company = "BMW", BirthDate = "1979-12-16", Email = "*****@*****.**", Position = "Senior Manager"
                };

                _context.AddRange(mem1, mem2, mem3, mem4);
                await _context.SaveChangesAsync();

                numberOfMembers = 4;
            }

            return($"{numberOfMembers} Members Added");
        }