public async Task EnsureSeedData()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                // Add the user.
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email = "*****@*****.**"
                };

                await _userManager.CreateAsync(newUser, "P@ssw0rd!");
            }

            if (!_context.Trips.Any())
            {
                // Add new Data
                var usTrip = new Trip()
                {
                    Name = "US Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Name = "Atlanta, GA", Arrival = new DateTime(2014, 6, 4), Order = 0, Latitude = 33.7550, Longitude = -84.3900 },
                        new Stop() { Name = "New York, NY", Arrival = new DateTime(2014, 6, 9), Order = 1, Latitude = 40.7127, Longitude = -74.0059 },
                        new Stop() { Name = "Boston, MA", Arrival = new DateTime(2014, 7, 1), Order = 2, Latitude = 42.3601, Longitude = -71.0589 },
                        new Stop() { Name = "Chicago, IL", Arrival = new DateTime(2014, 7, 10), Order = 3, Latitude = 41.8369, Longitude = -87.6847 },
                        new Stop() { Name = "Seattle, WA", Arrival = new DateTime(2014, 8, 13), Order = 4, Latitude = 47.6097, Longitude = -122.3331 },
                        new Stop() { Name = "Atlanta, GA", Arrival = new DateTime(2014, 8, 23), Order = 5, Latitude = 33.7550, Longitude = -84.3900 },
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                var worldTrip = new Trip()
                {
                    Name = "World Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Name = "Fort Lauderdale, FL", Arrival = new DateTime(2015, 10, 31), Order = 0, Latitude = 26.1333, Longitude = -80.1500 },
                        new Stop() { Name = "New York, NY", Arrival = new DateTime(2015, 11, 3), Order = 1, Latitude = 40.7127, Longitude = -74.0059 },
                        new Stop() { Name = "Amsterdam, Netherlands", Arrival = new DateTime(2015, 11, 13), Order = 2, Latitude = 52.3667, Longitude = 4.9000 },
                        new Stop() { Name = "Barcelona, Spain", Arrival = new DateTime(2016, 11, 20), Order = 3, Latitude = 41.3833, Longitude = 2.1833 },
                        new Stop() { Name = "Lyon, France", Arrival = new DateTime(2016, 12, 20), Order = 4, Latitude = 45.7600, Longitude = 4.8400 },
                        new Stop() { Name = "Prague, Czech Republic", Arrival = new DateTime(2016, 12, 22), Order = 5, Latitude = 50.0833, Longitude = 14.4167 },
                        new Stop() { Name = "New York, NY", Arrival = new DateTime(2016, 1, 5), Order = 6, Latitude = 40.7127, Longitude = -74.0059 },
                        new Stop() { Name = "Fort Lauderdale, FL", Arrival = new DateTime(2016, 1, 7), Order = 7, Latitude = 26.1333, Longitude = -80.1500 },
                    }
                };

                _context.Trips.Add(worldTrip);
                _context.Stops.AddRange(worldTrip.Stops);

                _context.SaveChanges();
            }
        }
        public async Task EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                // Add the user
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email = "*****@*****.**"
                };

                await _userManager.CreateAsync(newUser, "P@ssw0rd!");
            }

            if (!_context.Trips.Any())
            {
                //Add new data
                var usTrip = new Trip()
                {
                    Name = "US Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Name = "Atlanta, GA", Arrival = new DateTime(2014, 6, 4), Latitude = 33.748995, Longitude = -84.387982, Order = 0 },
                        new Stop() { Name = "New York, NY", Arrival = new DateTime(2014, 6, 9), Latitude = 40.712784, Longitude = -74.005941, Order = 1 },
                        new Stop() { Name = "Boston, MA", Arrival = new DateTime(2014, 7, 1), Latitude = 42.360082, Longitude = -71.058880, Order = 2 },
                        new Stop() { Name = "Chicago, IL", Arrival = new DateTime(2014, 7, 10), Latitude = 41.878114, Longitude = -87.629798, Order = 3 },
                        new Stop() { Name = "Seattle, WA", Arrival = new DateTime(2014, 8, 13), Latitude = 47.606209, Longitude = -122.332071, Order = 4 },
                        new Stop() { Name = "Atlanta, GA", Arrival = new DateTime(2014, 8, 23), Latitude = 33.748995, Longitude = -84.387982, Order = 5 }
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                var europeTrip = new Trip()
                {
                    Name = "Europe Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Order = 0, Latitude = 43.644991, Longitude = -79.394358, Name = "Toronto, Canada", Arrival = new DateTime(2015, 8, 21) },
                        new Stop() { Order = 1, Latitude = 41.391666, Longitude = 2.182251, Name = "Bacrelona, Spain", Arrival = new DateTime(2015, 8, 22) },
                        new Stop() { Order = 2, Latitude = 41.901885, Longitude = 12.479503, Name = "Rome, Italy", Arrival = new DateTime(2015, 8, 25) },
                        new Stop() { Order = 3, Latitude = 52.369898, Longitude = 4.894068, Name = "Amsterdam, Netherlands", Arrival = new DateTime(2015, 8, 28) },
                        new Stop() { Order = 4, Latitude = 51.513605, Longitude = -0.127010, Name = "London, United Kingdom", Arrival = new DateTime(2015, 8, 31) },
                        new Stop() { Order = 5, Latitude = 43.644991, Longitude = -79.394358, Name = "Toronto, Canada", Arrival = new DateTime(2015, 9, 5) }
                    }
                };

                _context.Trips.Add(europeTrip);
                _context.Stops.AddRange(europeTrip.Stops);

                _context.SaveChanges();

            }
        }
示例#3
0
        public async Task EnsureSeedDataAsync()
        {
            if ( await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                // Add the user
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email = "*****@*****.**"
                };

                await _userManager.CreateAsync(newUser, "P@ssw0rd!");
            }

            if (!_context.Trips.Any())
            {
                //Add new Data
                var usTrip = new Trip()
                {
                    Name = "US Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Name = "Atlanta, GA", Arrival = new DateTime(2014, 6, 4), Latitude = 33.748995, Longitude = -84.387982, Order = 0 },
                        new Stop() { Name = "New York, NY", Arrival = new DateTime(2014, 6, 9), Latitude = 40.712784, Longitude = -74.005941, Order = 1 },
                        new Stop() { Name = "Boston, MA", Arrival = new DateTime(2014, 7, 1), Latitude = 42.360082, Longitude = -71.058880, Order = 2 },
                        new Stop() { Name = "Chicago, IL", Arrival = new DateTime(2014, 7, 10), Latitude = 41.878114, Longitude = -87.629798, Order = 3 },
                        new Stop() { Name = "Seattle, WA", Arrival = new DateTime(2014, 8, 13), Latitude = 47.606209, Longitude = -122.332071, Order = 4 },
                        new Stop() { Name = "Atlanta, GA", Arrival = new DateTime(2014, 8, 23), Latitude = 33.748995, Longitude = -84.387982, Order = 5 }
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                var worldTrip = new Trip()
                {
                    Name = "World Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Order = 0, Latitude = 33.748995, Longitude = -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("Jun 3, 2014") },
                        new Stop() { Order = 1, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 4, 2014") },
                        new Stop() { Order = 2, Latitude = 50.850000, Longitude = 4.350000, Name = "Brussels, Belgium", Arrival = DateTime.Parse("Jun 25, 2014") },
                        new Stop() { Order = 3, Latitude = 51.209348, Longitude = 3.224700, Name = "Bruges, Belgium", Arrival = DateTime.Parse("Jun 28, 2014") },
                        new Stop() { Order = 4, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 30, 2014") },
                        new Stop() { Order = 5, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Jul 8, 2014") },
                        new Stop() { Order = 6, Latitude = 51.454513, Longitude = -2.587910, Name = "Bristol, UK", Arrival = DateTime.Parse("Jul 24, 2014") }
                    }
                };

                _context.Trips.Add(worldTrip);
                _context.Stops.AddRange(worldTrip.Stops);

                _context.SaveChanges();
            }
        }
        public async Task EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                // Add the user
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email = "*****@*****.**"
                };

                await _userManager.CreateAsync(newUser, "P@ssw0rd!");
            }

            if (!_context.Trips.Any())
            {
                // Add new data
                var usTrip = new Trip()
                {
                    Name = "US Trip",
                    Created = DateTime.Now,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Name = "Little Rock, AR", Arrival = new DateTime(2015, 9, 12), Latitude = 34.7361, Longitude = 92.3311, Order = 0 },
                        new Stop() { Name = "Nashville, TN", Arrival = new DateTime(2015, 9, 13), Latitude = 36.1667, Longitude = 86.7833, Order = 1 },
                        new Stop() { Name = "Akron, OH", Arrival = new DateTime(2015, 9, 14), Latitude = 41.0731, Longitude = 81.5178, Order = 2 }
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                var worldTrip = new Trip()
                {
                    Name = "World Trip",
                    Created = DateTime.Now,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Name = "London, England", Arrival = new DateTime(2015, 12, 1), Latitude = 51.5072, Longitude = 0.1275, Order = 0 },
                        new Stop() { Name = "Paris, France", Arrival = new DateTime(2015, 12, 4), Latitude = 48.8567, Longitude = 2.3508, Order = 1 }
                    }
                };

                _context.Trips.Add(worldTrip);
                _context.Stops.AddRange(worldTrip.Stops);

                _context.SaveChanges();
            }
        }
        public async Task EnsureSeedData()
        {
            if(await _userManager.FindByEmailAsync("*****@*****.**")==null)
            {
                //add user
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email = "*****@*****.**"
                };

                await _userManager.CreateAsync(newUser, "P@sdword");
            }


            if(!_context.Trips.Any())
            {
                var usTrip = new Trip()
                {
                    Name = "Us Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() {Name="New York", Order = 1, Arrival = new DateTime(2015,01,01), Latitude=50, Longitude=20 },
                        new Stop() {Name="Atlanta", Order = 2, Arrival = new DateTime(2015,01,15),  Latitude=52, Longitude=22 },
                        new Stop() {Name="Los Angeles", Order = 3, Arrival = new DateTime(2015,01,20), Latitude=54, Longitude=24 }
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                var euTrip = new Trip()
                {
                    Name = "Europe Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() {Name="London", Order = 1, Arrival = new DateTime(2015,02,01), Latitude=40, Longitude=10 },
                        new Stop() {Name="Paris", Order = 2, Arrival = new DateTime(2015,02,15),  Latitude=42, Longitude=12 },
                        new Stop() {Name="Krakow", Order = 3, Arrival = new DateTime(2015,02,20), Latitude=44, Longitude=14 }
                    }
                };
                _context.Trips.Add(euTrip);
                _context.Stops.AddRange(euTrip.Stops);

                _context.SaveChanges();
            }
        }
        public async Task EnsureSeedDataAsync()
        {
            //add a test user if necessary 
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                //add the user
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email = "*****@*****.**"
                };

                IdentityResult user = await _userManager.CreateAsync(newUser, "P@ssword1");
            }

            // if there are any trips
            if (!_context.Trips.Any())
            {
                // add new data
                var usTrip = new Trip()
                {
                    Name = "US Trips",
                    Created = DateTime.Now,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Name = "Home", Longitude = 51.969894, Latitude = -0.420675, Order = 0, Arrival = new DateTime(2014, 09, 01) },
                        new Stop() { Name = "San Franciso", Longitude = 37.801075, Latitude = -122.425037, Order = 1, Arrival = new DateTime(2014, 09, 01) },
                        new Stop() { Name = "Los Angeles", Longitude = 34.049957, Latitude = -118.253841, Order = 2, Arrival = new DateTime(2014, 09, 04) },
                        new Stop() { Name = "Home", Longitude = 51.969894, Latitude = -0.420675, Order = 3, Arrival = new DateTime(2014, 09, 11) }
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                _context.SaveChanges();
            }
        }
        public async Task EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email = "*****@*****.**"
                };

                await _userManager.CreateAsync(newUser, "P@ssw0rd");
            }

            if (!_context.Trips.Any())
            {
                var usTrip = new Trip()
                {
                    Name = "Us Trip",
                    Created = DateTime.Now,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Name = "Atlanta, GA", Arrival = new DateTime(2015, 6, 4), Latitude = 33.748995, Longitude = -84.387982, Order = 0},
                        new Stop() { Name = "New York, NY", Arrival = new DateTime(2015, 7, 5), Latitude = 40.712784, Longitude = -74.005941, Order = 1},
                        new Stop() { Name = "Boston, MA", Arrival = new DateTime(2015, 7, 20), Latitude = 42.360082, Longitude = -71.058880, Order = 2},
                        new Stop() { Name = "Chicago, IL", Arrival = new DateTime(2015, 7, 27), Latitude = 41.878114, Longitude = -87.629798, Order = 3},
                        new Stop() { Name = "Seattle, WA", Arrival = new DateTime(2015, 8, 4), Latitude = 47.606209, Longitude = -122.332071, Order = 4},
                        new Stop() { Name = "Atlanta, GA", Arrival = new DateTime(2015, 8, 20), Latitude = 33.748995, Longitude = -84.387982, Order = 5}
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                _context.SaveChanges();
            }
        }
示例#8
0
        public async Task EnsureSeedDataAsync()
        {
            if(await userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var newUser = new WorldUser
                {
                    UserName = "******",
                    Email = "*****@*****.**"
                };

                var result = await userManager.CreateAsync(newUser, "P@ssw0rd");
                if (result.Succeeded == false)
                {
                    var errors = result.Errors;
                }
            }

            if (context.Trips.Any() == false)
            {
                var usTrip = new Trip
                {
                    Name = "US Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>
                    {
                        new Stop
                        {
                            Name ="Atlanta, GA",
                            Arrival = new DateTime(2016,6,4),
                            Latitude = 33.748995,
                            Longitude = -84.387982,
                            Order = 0
                        }
                    }
                };

                context.Trips.Add(usTrip);
                context.Stops.AddRange(usTrip.Stops);

                var worldTrip = new Trip
                {
                    Name = "World Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>
                    {
                        new Stop
                        {
                            Order = 1,
                            Latitude = 33.748995,
                            Longitude = -84.387982,
                            Name ="Atlanta, Georgia",
                            Arrival = DateTime.Parse("Jun 4, 2016")
                        }
                    }
                };

                context.Trips.Add(worldTrip);
                context.Stops.AddRange(worldTrip.Stops);

                context.SaveChanges();
            }
        }
示例#9
0
        public async Task  EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                await _userManager.CreateAsync(newUser, "#Rmm8voub");
            }
            if (!_context.Trips.Any())
            {
                // Add new Data
                var usTrip = new Trip()
                {
                    Name     = "US Trip",
                    Created  = DateTime.UtcNow,
                    UserName = "******",
                    Stops    = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Milwaukee, WI", Arrival = new DateTime(2015, 6, 4), Latitude = 43.063348, Longitude = -87.966695, Order = 0
                        },
                        new Stop()
                        {
                            Name = "New York, NY", Arrival = new DateTime(2015, 6, 9), Latitude = 40.712784, Longitude = -74.005941, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Boston, MA", Arrival = new DateTime(2015, 7, 1), Latitude = 42.360082, Longitude = -71.058880, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Seattle, WA", Arrival = new DateTime(2015, 8, 13), Latitude = 47.606209, Longitude = -122.332071, Order = 4
                        },
                        new Stop()
                        {
                            Name = "Chicago, IL", Arrival = new DateTime(2015, 7, 10), Latitude = 41.878114, Longitude = -87.629798, Order = 3
                        },
                        new Stop()
                        {
                            Name = "Milwaukee, WI", Arrival = new DateTime(2015, 8, 23), Latitude = 43.063348, Longitude = -87.966695, Order = 5
                        },
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                var worldTrip = new Trip()
                {
                    Name     = "World Trip",
                    Created  = DateTime.UtcNow,
                    UserName = "******",
                    Stops    = new List <Stop>()
                    {
                        new Stop()
                        {
                            Order = 0, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Aug 10, 2015")
                        },
                        new Stop()
                        {
                            Order = 1, Latitude = 53.349805, Longitude = -6.260310, Name = "Dublin, Ireland", Arrival = DateTime.Parse("Sep 9, 2015")
                        },
                        new Stop()
                        {
                            Order = 2, Latitude = 47.368650, Longitude = 8.539183, Name = "Zurich, Switzerland", Arrival = DateTime.Parse("Sep 16, 2015")
                        },
                        new Stop()
                        {
                            Order = 3, Latitude = 48.135125, Longitude = 11.581981, Name = "Munich, Germany", Arrival = DateTime.Parse("Sep 19, 2015")
                        },
                    }
                };

                _context.Trips.Add(worldTrip);
                _context.Stops.AddRange(worldTrip.Stops);

                _context.SaveChanges();
            }
        }
        public async Task EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                //add the user
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };
                await _userManager.CreateAsync(newUser, "P@ssw0rd!");
            }
            if (!_context.Trips.Any())
            {
                //add new data
                var usTrip = new Trip()
                {
                    Name     = "Us Trip",
                    Created  = DateTime.UtcNow,
                    UserName = "******",
                    Stops    = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2016, 2, 3), Latitude = 33.74857, Longitude = -84.38669, Order = 0
                        },
                        new Stop()
                        {
                            Name = "New York, NY", Arrival = new DateTime(2016, 2, 10), Latitude = 40.71278, Longitude = -74.00594, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Boston,MA", Arrival = new DateTime(2016, 2, 20), Latitude = 42.36008, Longitude = -71.05888, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Chicago,IL", Arrival = new DateTime(2016, 3, 3), Latitude = 41.87811, Longitude = -87.62980, Order = 3
                        },
                        new Stop()
                        {
                            Name = "Seattle,WA", Arrival = new DateTime(2016, 3, 13), Latitude = 47.60621, Longitude = -122.3320, Order = 4
                        },
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2016, 3, 30), Latitude = 33.74857, Longitude = -84.38669, Order = 5
                        }
                    }
                };

                var worldrip = new Trip()
                {
                    Name     = "World Trip",
                    Created  = DateTime.UtcNow,
                    UserName = "******",
                    Stops    = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Atlanta, Georgia", Arrival = new DateTime(2016, 2, 3), Latitude = 33.74857, Longitude = -84.38669, Order = 0
                        },
                        new Stop()
                        {
                            Name = "Paris, France", Arrival = new DateTime(2016, 2, 10), Latitude = 40.71278, Longitude = -74.00594, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Brussels,Belgium", Arrival = new DateTime(2016, 2, 20), Latitude = 42.36008, Longitude = -71.05888, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Bruges,Belgium", Arrival = new DateTime(2016, 3, 3), Latitude = 41.87811, Longitude = -87.62980, Order = 3
                        },
                        new Stop()
                        {
                            Name = "Paris,France", Arrival = new DateTime(2016, 3, 13), Latitude = 47.60621, Longitude = -122.3320, Order = 4
                        },
                        new Stop()
                        {
                            Name = "London,UK", Arrival = new DateTime(2016, 3, 30), Latitude = 33.74857, Longitude = -84.38669, Order = 5
                        },
                        new Stop()
                        {
                            Name = "Atlanta, Georgia", Arrival = new DateTime(2016, 2, 3), Latitude = 33.74857, Longitude = -84.38669, Order = 6
                        }
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                _context.Trips.Add(worldrip);
                _context.Stops.AddRange(worldrip.Stops);

                _context.SaveChanges();
            }
        }
示例#11
0
        public async Task EnsureSeedData()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var user = new WorldUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                await _userManager.CreateAsync(user, "P@ssw0rd!");
            }

            //Adds data to db if there is nothhing in it
            if (!_context.Trips.Any())
            {
                var BurgerKing = new Organization()
                {
                    DateCreated = DateTime.UtcNow,
                    Name        = "Burger King"
                };

                var cashier = new JobTitle()
                {
                    DateCreated = DateTime.UtcNow,
                    Name        = "Cashier"
                };

                var tacoBell = new Organization()
                {
                    DateCreated = DateTime.UtcNow,
                    Name        = "Taco Bell"
                };

                var webDev = new JobTitle()
                {
                    DateCreated = DateTime.UtcNow,
                    Name        = "Web Developer"
                };

                var church = new Organization()
                {
                    DateCreated = DateTime.UtcNow,
                    Name        = "The Church of Jesus Christ of Latter-day Saints"
                };

                var byui = new Organization()
                {
                    DateCreated = DateTime.UtcNow,
                    Name        = "Brigham Young University - Idaho"
                };


                var usTrip = new Trip()
                {
                    DateCreated = DateTime.UtcNow,
                    Name        = "Logan's Career Path",
                    UserName    = "******",
                    Stops       = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Olathe, KS", Arrival = new DateTime(2006, 6, 4), Latitude = 38.8835296630859, Longitude = -94.8188705444336, Order = 0, Organization = BurgerKing, JobTitle = cashier
                        },
                        new Stop()
                        {
                            Name = "Olathe, KS", Arrival = new DateTime(2008, 6, 9), Latitude = 38.8835296630859, Longitude = -94.8188705444336, Order = 1, Organization = new Organization()
                            {
                                DateCreated = DateTime.UtcNow,
                                Name        = "Walmart"
                            }, JobTitle = cashier
                        },
                        new Stop()
                        {
                            Name = "Edinburgh, Scotland", Arrival = new DateTime(2010, 10, 22), Latitude = 55.9542999267578, Longitude = -3.20188999176025, Order = 2, Organization = church, JobTitle = new JobTitle()
                            {
                                DateCreated = DateTime.UtcNow,
                                Name        = "Missionary"
                            }
                        },
                        new Stop()
                        {
                            Name = "Olathe, KS", Arrival = new DateTime(2012, 10, 7), Latitude = 38.8835296630859, Longitude = -94.8188705444336, Order = 3, Organization = new Organization()
                            {
                                DateCreated = DateTime.UtcNow,
                                Name        = "Family Video"
                            }, JobTitle = cashier
                        },
                        new Stop()
                        {
                            Name = "Manhattan, KS", Arrival = new DateTime(2014, 8, 13), Latitude = 39.1788101196289, Longitude = -96.5618362426758, Order = 4, Organization = new Organization()
                            {
                                DateCreated = DateTime.UtcNow,
                                Name        = "Holiday Inn"
                            }, JobTitle = new JobTitle()
                            {
                                DateCreated = DateTime.UtcNow,
                                Name        = "Bellman"
                            }
                        },
                        new Stop()
                        {
                            Name = "Rexburg, ID", Arrival = new DateTime(2015, 1, 7), Latitude = 43.8260688781738, Longitude = -111.783088684082, Order = 5, Organization = byui, JobTitle = new JobTitle()
                            {
                                DateCreated = DateTime.UtcNow,
                                Name        = "Student"
                            }
                        },
                        new Stop()
                        {
                            Name = "Rexburg, ID", Arrival = new DateTime(2016, 4, 23), Latitude = 43.8260688781738, Longitude = -111.783088684082, Order = 5, Organization = byui, JobTitle = new JobTitle()
                            {
                                DateCreated = DateTime.UtcNow,
                                Name        = "Response Center Operator"
                            }
                        },
                        new Stop()
                        {
                            Name = "Riverton, UT", Arrival = new DateTime(2017, 4, 23), Latitude = 40.5205383300781, Longitude = -111.931671142578, Order = 5, Organization = church, JobTitle = webDev
                        }
                    }
                };

                _context.Trips.Add(usTrip);

                _context.Stops.AddRange(usTrip.Stops);

                var worldTrip = new Trip()
                {
                    DateCreated = DateTime.UtcNow,
                    Name        = "Logan's Dream path",
                    UserName    = "******",
                    Stops       = new List <Stop>()
                    {
                        new Stop()
                        {
                            Order = 0, Latitude = 33.748995, Longitude = -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("Jun 3, 2014"), Organization = tacoBell, JobTitle = webDev
                        },
                        new Stop()
                        {
                            Order = 1, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 4, 2014"), Organization = tacoBell, JobTitle = webDev
                        },
                        new Stop()
                        {
                            Order = 2, Latitude = 50.850000, Longitude = 4.350000, Name = "Brussels, Belgium", Arrival = DateTime.Parse("Jun 25, 2014"), Organization = tacoBell, JobTitle = webDev
                        },
                        new Stop()
                        {
                            Order = 3, Latitude = 51.209348, Longitude = 3.224700, Name = "Bruges, Belgium", Arrival = DateTime.Parse("Jun 28, 2014"), Organization = tacoBell, JobTitle = webDev
                        },
                        new Stop()
                        {
                            Order = 4, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 30, 2014"), Organization = tacoBell, JobTitle = webDev
                        },
                        new Stop()
                        {
                            Order = 5, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Jul 8, 2014"), Organization = tacoBell, JobTitle = webDev
                        },
                        new Stop()
                        {
                            Order = 6, Latitude = 51.454513, Longitude = -2.587910, Name = "Bristol, UK", Arrival = DateTime.Parse("Jul 24, 2014"), Organization = tacoBell, JobTitle = webDev
                        }
                    }
                };

                _context.Trips.Add(worldTrip);

                _context.Stops.AddRange(worldTrip.Stops);

                //push data to DB
                await _context.SaveChangesAsync();
            }
        }
示例#12
0
        public async Task EnsureDataAsync()
        {

            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email = "*****@*****.**"
                };
                await _userManager.CreateAsync(newUser, "P@ssw0rd!");
            }

            if (_context.Trips.Any()) return;
            var usTrip = new Trip
            {
                Name = "TR Trip",
                Created = DateTime.UtcNow,
                UserName = "",
                Stops = new List<Stop>()
                {
                    new Stop
                    {
                        //41�'N	29�'E
                        Name = "輘tanbul",
                        Arrival = new DateTime(2015, 1, 15),
                        Order = 1,
                        Latitude = 41,
                        Longitude = 29
                    },
                    new Stop
                    {
                        //	38�'N	27�'E
                        Name = "輟mir",
                        Arrival = new DateTime(2015, 3, 6),
                        Order = 2,
                        Latitude = 38.25,
                        Longitude = 27.08
                    },
                    new Stop
                    {
                        //39�'N	32�'E
                        Name = "Ankara",
                        Arrival = new DateTime(2015, 5, 8),
                        Order = 3,
                        Latitude = 39.57,
                        Longitude = 32.54
                    },
                    new Stop
                    {
                        //	39�'N	30�'E
                        Name = "Eski㧐hir",
                        Arrival = new DateTime(2015, 8, 24),
                        Order = 4,
                        Latitude = 39.50,
                        Longitude = 30.30
                    },
                    new Stop
                    {
                        //	39�'N	27�'E
                        Name = "Bal齥esir",
                        Arrival = new DateTime(2015, 9, 18),
                        Order = 5,
                        Latitude = 39.39,
                        Longitude = 27.53
                    },
                    new Stop
                    {
                        //38�'N	27�'E
                        Name = "Manisa",
                        Arrival = new DateTime(2015, 2, 11),
                        Order = 6,
                        Latitude = 38.38,
                        Longitude = 27.30
                    }
                }
            };
            _context.Trips.Add(usTrip);
            _context.Stops.AddRange(usTrip.Stops);
            _context.SaveChanges();
            // Add new Data
        }
示例#13
0
        public async Task EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                // Add the user
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                await _userManager.CreateAsync(newUser, "P@ssw0rd!");
            }

            if (!_context.Trips.Any())
            {
                //Add new data
                var usTrip = new Trip()
                {
                    Name     = "US Trip",
                    Created  = DateTime.UtcNow,
                    UserName = "******",
                    Stops    = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2014, 6, 4), Latitude = 33.748995, Longitude = -84.387982, Order = 0
                        },
                        new Stop()
                        {
                            Name = "New York, NY", Arrival = new DateTime(2014, 6, 9), Latitude = 40.712784, Longitude = -74.005941, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Boston, MA", Arrival = new DateTime(2014, 7, 1), Latitude = 42.360082, Longitude = -71.058880, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Chicago, IL", Arrival = new DateTime(2014, 7, 10), Latitude = 41.878114, Longitude = -87.629798, Order = 3
                        },
                        new Stop()
                        {
                            Name = "Seattle, WA", Arrival = new DateTime(2014, 8, 13), Latitude = 47.606209, Longitude = -122.332071, Order = 4
                        },
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2014, 8, 23), Latitude = 33.748995, Longitude = -84.387982, Order = 5
                        }
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                var europeTrip = new Trip()
                {
                    Name     = "Europe Trip",
                    Created  = DateTime.UtcNow,
                    UserName = "******",
                    Stops    = new List <Stop>()
                    {
                        new Stop()
                        {
                            Order = 0, Latitude = 43.644991, Longitude = -79.394358, Name = "Toronto, Canada", Arrival = new DateTime(2015, 8, 21)
                        },
                        new Stop()
                        {
                            Order = 1, Latitude = 41.391666, Longitude = 2.182251, Name = "Bacrelona, Spain", Arrival = new DateTime(2015, 8, 22)
                        },
                        new Stop()
                        {
                            Order = 2, Latitude = 41.901885, Longitude = 12.479503, Name = "Rome, Italy", Arrival = new DateTime(2015, 8, 25)
                        },
                        new Stop()
                        {
                            Order = 3, Latitude = 52.369898, Longitude = 4.894068, Name = "Amsterdam, Netherlands", Arrival = new DateTime(2015, 8, 28)
                        },
                        new Stop()
                        {
                            Order = 4, Latitude = 51.513605, Longitude = -0.127010, Name = "London, United Kingdom", Arrival = new DateTime(2015, 8, 31)
                        },
                        new Stop()
                        {
                            Order = 5, Latitude = 43.644991, Longitude = -79.394358, Name = "Toronto, Canada", Arrival = new DateTime(2015, 9, 5)
                        }
                    }
                };

                _context.Trips.Add(europeTrip);
                _context.Stops.AddRange(europeTrip.Stops);

                _context.SaveChanges();
            }
        }
        public async Task EnsureSeedDataAsync()
        {
            //
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                // add the users
                var newUser = new WorldUser()
                {
                    UserName  = "******",
                    Email     = "*****@*****.**",
                    FirstTrip = DateTime.UtcNow,
                };
                var x = await _userManager.CreateAsync(newUser, "P@ssword!1");
            }
            if (!_context.Trips.Any())
            {
                // Add new data

                var usTrip = new Trip()
                {
                    Name     = "US Trip",
                    Created  = DateTime.Now,
                    UserName = "******",
                    Stops    = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2014, 6, 4), Latitude = 33.748995, Longitude = -84.387982, Order = 0
                        },
                        new Stop()
                        {
                            Name = "New York, NY", Arrival = new DateTime(2014, 6, 9), Latitude = 40.712784, Longitude = -74.005941, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Boston, MA", Arrival = new DateTime(2014, 7, 1), Latitude = 42.360082, Longitude = -71.058880, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Chicago, IL", Arrival = new DateTime(2014, 7, 10), Latitude = 41.878114, Longitude = -87.629798, Order = 3
                        },
                        new Stop()
                        {
                            Name = "Seattle, WA", Arrival = new DateTime(2014, 8, 13), Latitude = 47.606209, Longitude = -122.332071, Order = 4
                        },
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2014, 8, 23), Latitude = 33.748995, Longitude = -84.387982, Order = 5
                        },
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                var worldTrip = new Trip()
                {
                    Name     = "World Trip",
                    Created  = DateTime.Now,
                    UserName = "******",
                    Stops    = new List <Stop>()
                    {
                        new Stop()
                        {
                            Order = 0, Latitude = 33.748995, Longitude = -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("Jun 3, 2014")
                        },
                        new Stop()
                        {
                            Order = 1, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 4, 2014")
                        },
                        new Stop()
                        {
                            Order = 2, Latitude = 50.850000, Longitude = 4.350000, Name = "Brussels, Belgium", Arrival = DateTime.Parse("Jun 25, 2014")
                        },
                        new Stop()
                        {
                            Order = 3, Latitude = 51.209348, Longitude = 3.224700, Name = "Bruges, Belgium", Arrival = DateTime.Parse("Jun 28, 2014")
                        },
                        new Stop()
                        {
                            Order = 4, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 30, 2014")
                        },
                        new Stop()
                        {
                            Order = 5, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Jul 8, 2014")
                        },
                        new Stop()
                        {
                            Order = 6, Latitude = 51.454513, Longitude = -2.587910, Name = "Bristol, UK", Arrival = DateTime.Parse("Jul 24, 2014")
                        },
                        new Stop()
                        {
                            Order = 7, Latitude = 52.078000, Longitude = -2.783000, Name = "Stretton Sugwas, UK", Arrival = DateTime.Parse("Jul 29, 2014")
                        },
                        new Stop()
                        {
                            Order = 8, Latitude = 51.864211, Longitude = -2.238034, Name = "Gloucestershire, UK", Arrival = DateTime.Parse("Jul 30, 2014")
                        },
                        new Stop()
                        {
                            Order = 9, Latitude = 52.954783, Longitude = -1.158109, Name = "Nottingham, UK", Arrival = DateTime.Parse("Jul 31, 2014")
                        },
                        new Stop()
                        {
                            Order = 10, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Aug 1, 2014")
                        },
                        new Stop()
                        {
                            Order = 11, Latitude = 55.953252, Longitude = -3.188267, Name = "Edinburgh, UK", Arrival = DateTime.Parse("Aug 5, 2014")
                        },
                        new Stop()
                        {
                            Order = 12, Latitude = 55.864237, Longitude = -4.251806, Name = "Glasgow, UK", Arrival = DateTime.Parse("Aug 6, 2014")
                        },
                        new Stop()
                        {
                            Order = 13, Latitude = 57.149717, Longitude = -2.094278, Name = "Aberdeen, UK", Arrival = DateTime.Parse("Aug 7, 2014")
                        },
                        new Stop()
                        {
                            Order = 14, Latitude = 55.953252, Longitude = -3.188267, Name = "Edinburgh, UK", Arrival = DateTime.Parse("Aug 8, 2014")
                        },
                        new Stop()
                        {
                            Order = 15, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Aug 10, 2014")
                        },
                        new Stop()
                        {
                            Order = 16, Latitude = 52.370216, Longitude = 4.895168, Name = "Amsterdam, Netherlands", Arrival = DateTime.Parse("Aug 14, 2014")
                        },
                        new Stop()
                        {
                            Order = 17, Latitude = 48.583148, Longitude = 7.747882, Name = "Strasbourg, France", Arrival = DateTime.Parse("Aug 17, 2014")
                        },
                        new Stop()
                        {
                            Order = 18, Latitude = 46.519962, Longitude = 6.633597, Name = "Lausanne, Switzerland", Arrival = DateTime.Parse("Aug 19, 2014")
                        },
                        new Stop()
                        {
                            Order = 19, Latitude = 46.021073, Longitude = 7.747937, Name = "Zermatt, Switzerland", Arrival = DateTime.Parse("Aug 27, 2014")
                        },
                        new Stop()
                        {
                            Order = 20, Latitude = 46.519962, Longitude = 6.633597, Name = "Lausanne, Switzerland", Arrival = DateTime.Parse("Aug 29, 2014")
                        },
                        new Stop()
                        {
                            Order = 21, Latitude = 53.349805, Longitude = -6.260310, Name = "Dublin, Ireland", Arrival = DateTime.Parse("Sep 2, 2014")
                        },
                        new Stop()
                        {
                            Order = 22, Latitude = 54.597285, Longitude = -5.930120, Name = "Belfast, Northern Ireland", Arrival = DateTime.Parse("Sep 7, 2014")
                        },
                        new Stop()
                        {
                            Order = 23, Latitude = 53.349805, Longitude = -6.260310, Name = "Dublin, Ireland", Arrival = DateTime.Parse("Sep 9, 2014")
                        },
                        new Stop()
                        {
                            Order = 24, Latitude = 47.368650, Longitude = 8.539183, Name = "Zurich, Switzerland", Arrival = DateTime.Parse("Sep 16, 2014")
                        },
                        new Stop()
                        {
                            Order = 25, Latitude = 48.135125, Longitude = 11.581981, Name = "Munich, Germany", Arrival = DateTime.Parse("Sep 19, 2014")
                        },
                        new Stop()
                        {
                            Order = 26, Latitude = 50.075538, Longitude = 14.437800, Name = "Prague, Czech Republic", Arrival = DateTime.Parse("Sep 21, 2014")
                        },
                        new Stop()
                        {
                            Order = 27, Latitude = 51.050409, Longitude = 13.737262, Name = "Dresden, Germany", Arrival = DateTime.Parse("Oct 1, 2014")
                        },
                        new Stop()
                        {
                            Order = 28, Latitude = 50.075538, Longitude = 14.437800, Name = "Prague, Czech Republic", Arrival = DateTime.Parse("Oct 4, 2014")
                        },
                        new Stop()
                        {
                            Order = 29, Latitude = 42.650661, Longitude = 18.094424, Name = "Dubrovnik, Croatia", Arrival = DateTime.Parse("Oct 10, 2014")
                        },
                        new Stop()
                        {
                            Order = 30, Latitude = 42.697708, Longitude = 23.321868, Name = "Sofia, Bulgaria", Arrival = DateTime.Parse("Oct 16, 2014")
                        },
                        new Stop()
                        {
                            Order = 31, Latitude = 45.658928, Longitude = 25.539608, Name = "Brosov, Romania", Arrival = DateTime.Parse("Oct 20, 2014")
                        },
                        new Stop()
                        {
                            Order = 32, Latitude = 41.005270, Longitude = 28.976960, Name = "Istanbul, Turkey", Arrival = DateTime.Parse("Nov 1, 2014")
                        },
                        new Stop()
                        {
                            Order = 33, Latitude = 45.815011, Longitude = 15.981919, Name = "Zagreb, Croatia", Arrival = DateTime.Parse("Nov 11, 2014")
                        },
                        new Stop()
                        {
                            Order = 34, Latitude = 41.005270, Longitude = 28.976960, Name = "Istanbul, Turkey", Arrival = DateTime.Parse("Nov 15, 2014")
                        },
                        new Stop()
                        {
                            Order = 35, Latitude = 50.850000, Longitude = 4.350000, Name = "Brussels, Belgium", Arrival = DateTime.Parse("Nov 25, 2014")
                        },
                        new Stop()
                        {
                            Order = 36, Latitude = 50.937531, Longitude = 6.960279, Name = "Cologne, Germany", Arrival = DateTime.Parse("Nov 30, 2014")
                        },
                        new Stop()
                        {
                            Order = 37, Latitude = 48.208174, Longitude = 16.373819, Name = "Vienna, Austria", Arrival = DateTime.Parse("Dec 4, 2014")
                        },
                        new Stop()
                        {
                            Order = 38, Latitude = 47.497912, Longitude = 19.040235, Name = "Budapest, Hungary", Arrival = DateTime.Parse("Dec 28,2014")
                        },
                        new Stop()
                        {
                            Order = 39, Latitude = 37.983716, Longitude = 23.729310, Name = "Athens, Greece", Arrival = DateTime.Parse("Jan 2, 2015")
                        },
                        new Stop()
                        {
                            Order = 40, Latitude = -25.746111, Longitude = 28.188056, Name = "Pretoria, South Africa", Arrival = DateTime.Parse("Jan 19, 2015")
                        },
                        new Stop()
                        {
                            Order = 41, Latitude = 43.771033, Longitude = 11.248001, Name = "Florence, Italy", Arrival = DateTime.Parse("Feb 1, 2015")
                        },
                        new Stop()
                        {
                            Order = 42, Latitude = 45.440847, Longitude = 12.315515, Name = "Venice, Italy", Arrival = DateTime.Parse("Feb 9, 2015")
                        },
                        new Stop()
                        {
                            Order = 43, Latitude = 43.771033, Longitude = 11.248001, Name = "Florence, Italy", Arrival = DateTime.Parse("Feb 13, 2015")
                        },
                        new Stop()
                        {
                            Order = 44, Latitude = 41.872389, Longitude = 12.480180, Name = "Rome, Italy", Arrival = DateTime.Parse("Feb 17, 2015")
                        },
                        new Stop()
                        {
                            Order = 45, Latitude = 28.632244, Longitude = 77.220724, Name = "New Delhi, India", Arrival = DateTime.Parse("Mar 4, 2015")
                        },
                        new Stop()
                        {
                            Order = 46, Latitude = 27.700000, Longitude = 85.333333, Name = "Kathmandu, Nepal", Arrival = DateTime.Parse("Mar 10, 2015")
                        },
                        new Stop()
                        {
                            Order = 47, Latitude = 28.632244, Longitude = 77.220724, Name = "New Delhi, India", Arrival = DateTime.Parse("Mar 11, 2015")
                        },
                        new Stop()
                        {
                            Order = 48, Latitude = 22.1667, Longitude = 113.5500, Name = "Macau", Arrival = DateTime.Parse("Mar 21, 2015")
                        },
                        new Stop()
                        {
                            Order = 49, Latitude = 22.396428, Longitude = 114.109497, Name = "Hong Kong", Arrival = DateTime.Parse("Mar 24, 2015")
                        },
                        new Stop()
                        {
                            Order = 50, Latitude = 39.904030, Longitude = 116.407526, Name = "Beijing, China", Arrival = DateTime.Parse("Apr 19, 2015")
                        },
                        new Stop()
                        {
                            Order = 51, Latitude = 22.396428, Longitude = 114.109497, Name = "Hong Kong", Arrival = DateTime.Parse("Apr 24, 2015")
                        },
                        new Stop()
                        {
                            Order = 52, Latitude = 1.352083, Longitude = 103.819836, Name = "Singapore", Arrival = DateTime.Parse("Apr 30, 2015")
                        },
                        new Stop()
                        {
                            Order = 53, Latitude = 3.139003, Longitude = 101.686855, Name = "Kuala Lumpor, Malaysia", Arrival = DateTime.Parse("May 7, 2015")
                        },
                        new Stop()
                        {
                            Order = 54, Latitude = 13.727896, Longitude = 100.524123, Name = "Bangkok, Thailand", Arrival = DateTime.Parse("May 24, 2015")
                        },
                        new Stop()
                        {
                            Order = 55, Latitude = 33.748995, Longitude = -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("Jun 17, 2015")
                        },
                    }
                };

                _context.Trips.Add(worldTrip);
                _context.Stops.AddRange(worldTrip.Stops);

                _context.SaveChanges();
            }
        }
示例#15
0
        public async Task EnsureSeedDate()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var user = new WorldUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                await _userManager.CreateAsync(user, "P@ssw0rd!");
            }

            if (!_context.Trips.Any())
            {
                var ustrip = new Trip()
                {
                    DateCreate = DateTime.UtcNow,
                    Name       = "US Trip",
                    UserName   = "******",
                    Stops      = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Milton", Arrival = new DateTime(2017, 08, 4), Latitude = 33.451245, Order = 0
                        },
                        new Stop()
                        {
                            Name = "Jose", Arrival = new DateTime(2017, 08, 5), Latitude = 33.451245, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Carlos", Arrival = new DateTime(2017, 08, 23), Latitude = 33.451245, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Andrea", Arrival = new DateTime(2017, 08, 12), Latitude = 33.451245, Order = 3
                        },
                        new Stop()
                        {
                            Name = "Esteban", Arrival = new DateTime(2017, 08, 12), Latitude = 33.451245, Order = 4
                        },
                        new Stop()
                        {
                            Name = "Cristian", Arrival = new DateTime(2017, 08, 6), Latitude = 33.451245, Order = 5
                        }
                    }
                };
                _context.Trips.Add(ustrip);
                _context.Stops.AddRange(ustrip.Stops);

                var wordlTrip = new Trip()
                {
                    DateCreate = DateTime.UtcNow,
                    Name       = "WorldTrip",
                    UserName   = "******",
                    Stops      = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Milton", Arrival = new DateTime(2017, 08, 4), Latitude = 33.451245, Order = 0
                        },
                        new Stop()
                        {
                            Name = "Jose", Arrival = new DateTime(2017, 08, 5), Latitude = 33.4512452, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Carlos", Arrival = new DateTime(2017, 08, 23), Latitude = 33.5653665, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Andrea", Arrival = new DateTime(2017, 08, 12), Latitude = 33.765676, Order = 3
                        },
                        new Stop()
                        {
                            Name = "Esteban", Arrival = new DateTime(2017, 08, 12), Latitude = 33.754554, Order = 4
                        },
                        new Stop()
                        {
                            Name = "Cristian", Arrival = new DateTime(2017, 08, 6), Latitude = 33.6543456, Order = 5
                        },

                        new Stop()
                        {
                            Name = "Roberto", Arrival = new DateTime(2017, 08, 4), Latitude = 33.546655, Order = 6
                        },
                        new Stop()
                        {
                            Name = "Micols", Arrival = new DateTime(2017, 08, 5), Latitude = 33.4776764, Order = 7
                        },
                        new Stop()
                        {
                            Name = "Rosa", Arrival = new DateTime(2017, 08, 23), Latitude = 33.4875676, Order = 8
                        },
                    }
                };

                _context.Trips.Add(wordlTrip);
                _context.Stops.AddRange(wordlTrip.Stops);

                await _context.SaveChangesAsync();
            }
        }
示例#16
0
        public async Task EnsureSeedData()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var user = new WorldUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                await _userManager.CreateAsync(user, "P@ssw0rd!");
            }


            if (!_context.Trips.Any())
            {
                var usTrip = new Trip()
                {
                    DateCreated = DateTime.Now,
                    Name        = "Us Trip",
                    UserName    = "",
                    Stops       = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2014, 6, 4), Latitude = 33.748995, Longitude = -84.387982, Order = 0
                        },
                        new Stop()
                        {
                            Name = "New York, NY", Arrival = new DateTime(2014, 6, 9), Latitude = 40.712784, Longitude = -74.005941, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Boston, MA", Arrival = new DateTime(2014, 7, 1), Latitude = 42.360082, Longitude = -71.058880, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Chicago, IL", Arrival = new DateTime(2014, 7, 10), Latitude = 41.878114, Longitude = -87.629798, Order = 3
                        },
                        new Stop()
                        {
                            Name = "Seattle, WA", Arrival = new DateTime(2014, 8, 13), Latitude = 47.606209, Longitude = -122.332071, Order = 4
                        },
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2014, 8, 23), Latitude = 33.748995, Longitude = -84.387982, Order = 5
                        },
                    }
                };

                // Adds the object data to the database!
                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);


                var worldTrip = new Trip()
                {
                    DateCreated = DateTime.Now,
                    Name        = "World Trip",
                    UserName    = "******",
                    Stops       = new List <Stop>()
                    {
                        // This dummy data is heavily abbreviated from the sample in the tutorial (which contained 50+ points)
                        new Stop()
                        {
                            Order = 0, Latitude = 33.748995, Longitude = -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("June 3, 2014")
                        },
                        new Stop()
                        {
                            Order = 1, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("June 4, 2014")
                        },
                        new Stop()
                        {
                            Order = 2, Latitude = 50.850000, Longitude = 4.350000, Name = "Brussels, Belgium", Arrival = DateTime.Parse("June 25, 2014")
                        },
                        new Stop()
                        {
                            Order = 3, Latitude = 51.209348, Longitude = 3.224700, Name = "Bruges, Belgium", Arrival = DateTime.Parse("June 28, 2014")
                        },
                        new Stop()
                        {
                            Order = 4, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("June 20, 2014")
                        },
                        new Stop()
                        {
                            Order = 5, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("July 8, 2014")
                        },
                        new Stop()
                        {
                            Order = 6, Latitude = 33.748995, Longitude = -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("July 14, 2014")
                        }
                    }
                };

                _context.Trips.Add(worldTrip);
                _context.Stops.AddRange(worldTrip.Stops);


                //pushes the data to the database!
                await _context.SaveChangesAsync();
            }
        }
        // Async method needed to return a task
        public async Task EnsureSeedData()
        {
            // test to see if the user exists
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                //user doesn't exist yet. create
                var user = new WorldUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                // Create with user obj and a password (temp or config) has to meet password criteria
                await _userManager.CreateAsync(user, "P@ssw0rd!");   // will get changed with config settings
            }
            // check if there are any objects (trips in the DB) if not add some sample DB. if so, skip
            if (!_context.Trips.Any())
            {
                // Create an instance of a trip. Linkage of the WorldUser and the actual trips by querying against
                var usTrip = new Trip()
                {
                    DateCreated = DateTime.UtcNow,
                    Name        = "US Trip",
                    UserName    = "******",
                    Stops       = new List <Stop>() // Empty collection to hold stops
                    {
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2014, 6, 4), Latitude = 33.748995, Longitude = -84.387982, Order = 0
                        },
                        new Stop()
                        {
                            Name = "New York, NY", Arrival = new DateTime(2014, 6, 9), Latitude = 40.712784, Longitude = -74.005941, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Boston, MA", Arrival = new DateTime(2014, 7, 1), Latitude = 42.360082, Longitude = -71.058880, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Chicago, IL", Arrival = new DateTime(2014, 7, 10), Latitude = 41.878114, Longitude = -87.629798, Order = 3
                        },
                        new Stop()
                        {
                            Name = "Seattle, WA", Arrival = new DateTime(2014, 8, 13), Latitude = 47.606209, Longitude = -122.332071, Order = 4
                        },
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2014, 8, 23), Latitude = 33.748995, Longitude = -84.387982, Order = 5
                        },
                    }
                };

                // Finish up us trips with Add to context.
                _context.Trips.Add(usTrip);

                // When save changes is called, take all stops added to this trip object and add it to the Stops DB.
                _context.Stops.AddRange(usTrip.Stops);

                var worldTrip = new Trip()
                {
                    DateCreated = DateTime.UtcNow,
                    Name        = "WorldTrip",
                    UserName    = "******",
                    Stops       = new List <Stop>() // Empty collection to hold stops
                    {
                        new Stop()
                        {
                            Order = 0, Latitude = 33.748995, Longitude = -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("Jun 3, 2014")
                        },
                        new Stop()
                        {
                            Order = 1, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 4, 2014")
                        },
                        new Stop()
                        {
                            Order = 2, Latitude = 50.850000, Longitude = 4.350000, Name = "Brussels, Belgium", Arrival = DateTime.Parse("Jun 25, 2014")
                        },
                        new Stop()
                        {
                            Order = 3, Latitude = 51.209348, Longitude = 3.224700, Name = "Bruges, Belgium", Arrival = DateTime.Parse("Jun 28, 2014")
                        },
                        new Stop()
                        {
                            Order = 4, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 30, 2014")
                        },
                        new Stop()
                        {
                            Order = 5, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Jul 8, 2014")
                        },
                        new Stop()
                        {
                            Order = 6, Latitude = 51.454513, Longitude = -2.587910, Name = "Bristol, UK", Arrival = DateTime.Parse("Jul 24, 2014")
                        },
                        new Stop()
                        {
                            Order = 7, Latitude = 52.078000, Longitude = -2.783000, Name = "Stretton Sugwas, UK", Arrival = DateTime.Parse("Jul 29, 2014")
                        },
                        new Stop()
                        {
                            Order = 8, Latitude = 51.864211, Longitude = -2.238034, Name = "Gloucestershire, UK", Arrival = DateTime.Parse("Jul 30, 2014")
                        },
                        new Stop()
                        {
                            Order = 9, Latitude = 52.954783, Longitude = -1.158109, Name = "Nottingham, UK", Arrival = DateTime.Parse("Jul 31, 2014")
                        },
                        new Stop()
                        {
                            Order = 10, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Aug 1, 2014")
                        },
                        new Stop()
                        {
                            Order = 11, Latitude = 55.953252, Longitude = -3.188267, Name = "Edinburgh, UK", Arrival = DateTime.Parse("Aug 5, 2014")
                        },
                        new Stop()
                        {
                            Order = 12, Latitude = 55.864237, Longitude = -4.251806, Name = "Glasgow, UK", Arrival = DateTime.Parse("Aug 6, 2014")
                        },
                        new Stop()
                        {
                            Order = 13, Latitude = 57.149717, Longitude = -2.094278, Name = "Aberdeen, UK", Arrival = DateTime.Parse("Aug 7, 2014")
                        },
                        new Stop()
                        {
                            Order = 14, Latitude = 55.953252, Longitude = -3.188267, Name = "Edinburgh, UK", Arrival = DateTime.Parse("Aug 8, 2014")
                        },
                        new Stop()
                        {
                            Order = 15, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Aug 10, 2014")
                        },
                        new Stop()
                        {
                            Order = 16, Latitude = 52.370216, Longitude = 4.895168, Name = "Amsterdam, Netherlands", Arrival = DateTime.Parse("Aug 14, 2014")
                        },
                        new Stop()
                        {
                            Order = 17, Latitude = 48.583148, Longitude = 7.747882, Name = "Strasbourg, France", Arrival = DateTime.Parse("Aug 17, 2014")
                        },
                        new Stop()
                        {
                            Order = 18, Latitude = 46.519962, Longitude = 6.633597, Name = "Lausanne, Switzerland", Arrival = DateTime.Parse("Aug 19, 2014")
                        },
                        new Stop()
                        {
                            Order = 19, Latitude = 46.021073, Longitude = 7.747937, Name = "Zermatt, Switzerland", Arrival = DateTime.Parse("Aug 27, 2014")
                        },
                        new Stop()
                        {
                            Order = 20, Latitude = 46.519962, Longitude = 6.633597, Name = "Lausanne, Switzerland", Arrival = DateTime.Parse("Aug 29, 2014")
                        },
                        new Stop()
                        {
                            Order = 21, Latitude = 53.349805, Longitude = -6.260310, Name = "Dublin, Ireland", Arrival = DateTime.Parse("Sep 2, 2014")
                        },
                        new Stop()
                        {
                            Order = 22, Latitude = 54.597285, Longitude = -5.930120, Name = "Belfast, Northern Ireland", Arrival = DateTime.Parse("Sep 7, 2014")
                        },
                        new Stop()
                        {
                            Order = 23, Latitude = 53.349805, Longitude = -6.260310, Name = "Dublin, Ireland", Arrival = DateTime.Parse("Sep 9, 2014")
                        },
                        new Stop()
                        {
                            Order = 24, Latitude = 47.368650, Longitude = 8.539183, Name = "Zurich, Switzerland", Arrival = DateTime.Parse("Sep 16, 2014")
                        },
                        new Stop()
                        {
                            Order = 25, Latitude = 48.135125, Longitude = 11.581981, Name = "Munich, Germany", Arrival = DateTime.Parse("Sep 19, 2014")
                        },
                        new Stop()
                        {
                            Order = 26, Latitude = 50.075538, Longitude = 14.437800, Name = "Prague, Czech Republic", Arrival = DateTime.Parse("Sep 21, 2014")
                        },
                        new Stop()
                        {
                            Order = 27, Latitude = 51.050409, Longitude = 13.737262, Name = "Dresden, Germany", Arrival = DateTime.Parse("Oct 1, 2014")
                        },
                        new Stop()
                        {
                            Order = 28, Latitude = 50.075538, Longitude = 14.437800, Name = "Prague, Czech Republic", Arrival = DateTime.Parse("Oct 4, 2014")
                        },
                        new Stop()
                        {
                            Order = 29, Latitude = 42.650661, Longitude = 18.094424, Name = "Dubrovnik, Croatia", Arrival = DateTime.Parse("Oct 10, 2014")
                        },
                        new Stop()
                        {
                            Order = 30, Latitude = 42.697708, Longitude = 23.321868, Name = "Sofia, Bulgaria", Arrival = DateTime.Parse("Oct 16, 2014")
                        },
                        new Stop()
                        {
                            Order = 31, Latitude = 45.658928, Longitude = 25.539608, Name = "Brosov, Romania", Arrival = DateTime.Parse("Oct 20, 2014")
                        },
                        new Stop()
                        {
                            Order = 32, Latitude = 41.005270, Longitude = 28.976960, Name = "Istanbul, Turkey", Arrival = DateTime.Parse("Nov 1, 2014")
                        },
                        new Stop()
                        {
                            Order = 33, Latitude = 45.815011, Longitude = 15.981919, Name = "Zagreb, Croatia", Arrival = DateTime.Parse("Nov 11, 2014")
                        },
                        new Stop()
                        {
                            Order = 34, Latitude = 41.005270, Longitude = 28.976960, Name = "Istanbul, Turkey", Arrival = DateTime.Parse("Nov 15, 2014")
                        },
                        new Stop()
                        {
                            Order = 35, Latitude = 50.850000, Longitude = 4.350000, Name = "Brussels, Belgium", Arrival = DateTime.Parse("Nov 25, 2014")
                        },
                        new Stop()
                        {
                            Order = 36, Latitude = 50.937531, Longitude = 6.960279, Name = "Cologne, Germany", Arrival = DateTime.Parse("Nov 30, 2014")
                        },
                        new Stop()
                        {
                            Order = 37, Latitude = 48.208174, Longitude = 16.373819, Name = "Vienna, Austria", Arrival = DateTime.Parse("Dec 4, 2014")
                        },
                        new Stop()
                        {
                            Order = 38, Latitude = 47.497912, Longitude = 19.040235, Name = "Budapest, Hungary", Arrival = DateTime.Parse("Dec 28,2014")
                        },
                        new Stop()
                        {
                            Order = 39, Latitude = 37.983716, Longitude = 23.729310, Name = "Athens, Greece", Arrival = DateTime.Parse("Jan 2, 2015")
                        },
                        new Stop()
                        {
                            Order = 40, Latitude = -25.746111, Longitude = 28.188056, Name = "Pretoria, South Africa", Arrival = DateTime.Parse("Jan 19, 2015")
                        },
                        new Stop()
                        {
                            Order = 41, Latitude = 43.771033, Longitude = 11.248001, Name = "Florence, Italy", Arrival = DateTime.Parse("Feb 1, 2015")
                        },
                        new Stop()
                        {
                            Order = 42, Latitude = 45.440847, Longitude = 12.315515, Name = "Venice, Italy", Arrival = DateTime.Parse("Feb 9, 2015")
                        },
                        new Stop()
                        {
                            Order = 43, Latitude = 43.771033, Longitude = 11.248001, Name = "Florence, Italy", Arrival = DateTime.Parse("Feb 13, 2015")
                        },
                        new Stop()
                        {
                            Order = 44, Latitude = 41.872389, Longitude = 12.480180, Name = "Rome, Italy", Arrival = DateTime.Parse("Feb 17, 2015")
                        },
                        new Stop()
                        {
                            Order = 45, Latitude = 28.632244, Longitude = 77.220724, Name = "New Delhi, India", Arrival = DateTime.Parse("Mar 4, 2015")
                        },
                        new Stop()
                        {
                            Order = 46, Latitude = 27.700000, Longitude = 85.333333, Name = "Kathmandu, Nepal", Arrival = DateTime.Parse("Mar 10, 2015")
                        },
                        new Stop()
                        {
                            Order = 47, Latitude = 28.632244, Longitude = 77.220724, Name = "New Delhi, India", Arrival = DateTime.Parse("Mar 11, 2015")
                        },
                        new Stop()
                        {
                            Order = 48, Latitude = 22.1667, Longitude = 113.5500, Name = "Macau", Arrival = DateTime.Parse("Mar 21, 2015")
                        },
                        new Stop()
                        {
                            Order = 49, Latitude = 22.396428, Longitude = 114.109497, Name = "Hong Kong", Arrival = DateTime.Parse("Mar 24, 2015")
                        },
                        new Stop()
                        {
                            Order = 50, Latitude = 39.904030, Longitude = 116.407526, Name = "Beijing, China", Arrival = DateTime.Parse("Apr 19, 2015")
                        },
                        new Stop()
                        {
                            Order = 51, Latitude = 22.396428, Longitude = 114.109497, Name = "Hong Kong", Arrival = DateTime.Parse("Apr 24, 2015")
                        },
                        new Stop()
                        {
                            Order = 52, Latitude = 1.352083, Longitude = 103.819836, Name = "Singapore", Arrival = DateTime.Parse("Apr 30, 2015")
                        },
                        new Stop()
                        {
                            Order = 53, Latitude = 3.139003, Longitude = 101.686855, Name = "Kuala Lumpor, Malaysia", Arrival = DateTime.Parse("May 7, 2015")
                        },
                        new Stop()
                        {
                            Order = 54, Latitude = 13.727896, Longitude = 100.524123, Name = "Bangkok, Thailand", Arrival = DateTime.Parse("May 24, 2015")
                        },
                        new Stop()
                        {
                            Order = 55, Latitude = 33.748995, Longitude = -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("Jun 17, 2015")
                        },
                    }
                };

                // Finish up world trips with Add to context.
                _context.Trips.Add(worldTrip);
                // When save changes is called, take all stops added to this trip object and add it to the Stops DB.
                _context.Stops.AddRange(worldTrip.Stops);

                // Creating the sorts of sample data and added to the context so it knows they are new objects
                // Now call await to push the data out to DB (wherever the DB might exist)
                await _context.SaveChangesAsync();
            }
        }
示例#18
0
        public async Task EnsureSeedData()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var user = new WorldUser
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };
                await _userManager.CreateAsync(user, "P@ssw0rd!");
            }

            if (!_context.Trips.Any())
            {
                var usTrip = new Trip
                {
                    CreatedOn = DateTime.UtcNow,
                    Name      = "UsTrip",
                    UserName  = "******", //TODO WHEN AUTHENTICATION ADDS
                    Stops     = new List <Stop>
                    {
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2014, 6, 4), Latitude = 33.748995, Longitude = -84.387982, Order = 0
                        },
                        new Stop()
                        {
                            Name = "New York, NY", Arrival = new DateTime(2014, 6, 9), Latitude = 40.712784, Longitude = -74.005941, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Boston, MA", Arrival = new DateTime(2014, 7, 1), Latitude = 42.360082, Longitude = -71.058880, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Chicago, IL", Arrival = new DateTime(2014, 7, 10), Latitude = 41.878114, Longitude = -87.629798, Order = 3
                        },
                        new Stop()
                        {
                            Name = "Seattle, WA", Arrival = new DateTime(2014, 8, 13), Latitude = 47.606209, Longitude = -122.332071, Order = 4
                        },
                        new Stop()
                        {
                            Name = "Atlanta, GA", Arrival = new DateTime(2014, 8, 23), Latitude = 33.748995, Longitude = -84.387982, Order = 5
                        },
                    }
                };
                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);
            }

            var worldTrip = new Trip
            {
                CreatedOn = DateTime.UtcNow,
                Name      = "WorldTrip",
                UserName  = "******", //TODO WHEN AUTHENCTICATION
                Stops     = new List <Stop>
                {
                    new Stop()
                    {
                        Order = 0, Latitude = 33.748995, Longitude = -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("Jun 3, 2014")
                    },
                    new Stop()
                    {
                        Order = 1, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 4, 2014")
                    },
                    new Stop()
                    {
                        Order = 2, Latitude = 50.850000, Longitude = 4.350000, Name = "Brussels, Belgium", Arrival = DateTime.Parse("Jun 25, 2014")
                    },
                    new Stop()
                    {
                        Order = 3, Latitude = 51.209348, Longitude = 3.224700, Name = "Bruges, Belgium", Arrival = DateTime.Parse("Jun 28, 2014")
                    },
                    new Stop()
                    {
                        Order = 4, Latitude = 48.856614, Longitude = 2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 30, 2014")
                    },
                    new Stop()
                    {
                        Order = 5, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Jul 8, 2014")
                    },
                    new Stop()
                    {
                        Order = 6, Latitude = 51.454513, Longitude = -2.587910, Name = "Bristol, UK", Arrival = DateTime.Parse("Jul 24, 2014")
                    },
                    new Stop()
                    {
                        Order = 7, Latitude = 52.078000, Longitude = -2.783000, Name = "Stretton Sugwas, UK", Arrival = DateTime.Parse("Jul 29, 2014")
                    },
                    new Stop()
                    {
                        Order = 8, Latitude = 51.864211, Longitude = -2.238034, Name = "Gloucestershire, UK", Arrival = DateTime.Parse("Jul 30, 2014")
                    },
                    new Stop()
                    {
                        Order = 9, Latitude = 52.954783, Longitude = -1.158109, Name = "Nottingham, UK", Arrival = DateTime.Parse("Jul 31, 2014")
                    },
                    new Stop()
                    {
                        Order = 10, Latitude = 51.508515, Longitude = -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Aug 1, 2014")
                    },
                    new Stop()
                    {
                        Order = 11, Latitude = 55.953252, Longitude = -3.188267, Name = "Edinburgh, UK", Arrival = DateTime.Parse("Aug 5, 2014")
                    },
                    new Stop()
                    {
                        Order = 12, Latitude = 55.864237, Longitude = -4.251806, Name = "Glasgow, UK", Arrival = DateTime.Parse("Aug 6, 2014")
                    },
                    new Stop()
                    {
                        Order = 13, Latitude = 57.149717, Longitude = -2.094278, Name = "Aberdeen, UK", Arrival = DateTime.Parse("Aug 7, 2014")
                    },
                }
            };

            _context.Trips.Add(worldTrip);
            _context.Stops.AddRange(worldTrip.Stops);

            await _context.SaveChangesAsync();
        }
示例#19
0
        public async Task EnsureSeedDataAsync()
        {
            if (await userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var newUser = new WorldUser
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                var result = await userManager.CreateAsync(newUser, "P@ssw0rd");

                if (result.Succeeded == false)
                {
                    var errors = result.Errors;
                }
            }

            if (context.Trips.Any() == false)
            {
                var usTrip = new Trip
                {
                    Name     = "US Trip",
                    Created  = DateTime.UtcNow,
                    UserName = "******",
                    Stops    = new List <Stop>
                    {
                        new Stop
                        {
                            Name      = "Atlanta, GA",
                            Arrival   = new DateTime(2016, 6, 4),
                            Latitude  = 33.748995,
                            Longitude = -84.387982,
                            Order     = 0
                        }
                    }
                };

                context.Trips.Add(usTrip);
                context.Stops.AddRange(usTrip.Stops);

                var worldTrip = new Trip
                {
                    Name     = "World Trip",
                    Created  = DateTime.UtcNow,
                    UserName = "******",
                    Stops    = new List <Stop>
                    {
                        new Stop
                        {
                            Order     = 1,
                            Latitude  = 33.748995,
                            Longitude = -84.387982,
                            Name      = "Atlanta, Georgia",
                            Arrival   = DateTime.Parse("Jun 4, 2016")
                        }
                    }
                };

                context.Trips.Add(worldTrip);
                context.Stops.AddRange(worldTrip.Stops);

                context.SaveChanges();
            }
        }
示例#20
0
        public async Task EnsureSeedDataAsync()
        {
            if (_userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                // add user
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email = "*****@*****.**"
                };
                await _userManager.CreateAsync(newUser, "P@ssw0rd!");
            }

            if (!_context.Trips.Any())
            {
                var usTrip = new Trip()
                {
                    Name = "US Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() {  Name = "Atlanta, GA", Arrival = new DateTime(2014, 6, 4), Latitude = 33.748995, Longitude = -84.387982, Order = 0 },
                        new Stop() {  Name = "New York, NY", Arrival = new DateTime(2014, 6, 9), Latitude = 40.712784, Longitude = -74.005941, Order = 1 },
                        new Stop() {  Name = "Boston, MA", Arrival = new DateTime(2014, 7, 1), Latitude = 42.360082, Longitude = -71.058880, Order = 2 },
                        new Stop() {  Name = "Chicago, IL", Arrival = new DateTime(2014, 7, 10), Latitude = 41.878114, Longitude = -87.629798, Order = 3 },
                        new Stop() {  Name = "Seattle, WA", Arrival = new DateTime(2014, 8, 13), Latitude = 47.606209, Longitude = -122.332071, Order = 4 },
                        new Stop() {  Name = "Atlanta, GA", Arrival = new DateTime(2014, 8, 23), Latitude = 33.748995, Longitude = -84.387982, Order = 5 }
                    }
                };

                _context.Trips.Add(usTrip);
                _context.Stops.AddRange(usTrip.Stops);

                var worldTrip = new Trip()
                {
                    Name = "World Trip",
                    Created = DateTime.UtcNow,
                    UserName = "******",
                    Stops = new List<Stop>()
                    {
                        new Stop() { Order = 0, Latitude =  33.748995, Longitude =  -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("Jun 3, 2014") },
                        new Stop() { Order = 1, Latitude =  48.856614, Longitude =  2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 4, 2014") },
                        new Stop() { Order = 2, Latitude =  50.850000, Longitude =  4.350000, Name = "Brussels, Belgium", Arrival = DateTime.Parse("Jun 25, 2014") },
                        new Stop() { Order = 3, Latitude =  51.209348, Longitude =  3.224700, Name = "Bruges, Belgium", Arrival = DateTime.Parse("Jun 28, 2014") },
                        new Stop() { Order = 4, Latitude =  48.856614, Longitude =  2.352222, Name = "Paris, France", Arrival = DateTime.Parse("Jun 30, 2014") },
                        new Stop() { Order = 5, Latitude =  51.508515, Longitude =  -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Jul 8, 2014") },
                        new Stop() { Order = 6, Latitude =  51.454513, Longitude =  -2.587910, Name = "Bristol, UK", Arrival = DateTime.Parse("Jul 24, 2014") },
                        new Stop() { Order = 7, Latitude =  52.078000, Longitude =  -2.783000, Name = "Stretton Sugwas, UK", Arrival = DateTime.Parse("Jul 29, 2014") },
                        new Stop() { Order = 8, Latitude =  51.864211, Longitude =  -2.238034, Name = "Gloucestershire, UK", Arrival = DateTime.Parse("Jul 30, 2014") },
                        new Stop() { Order = 9, Latitude =  52.954783, Longitude =  -1.158109, Name = "Nottingham, UK", Arrival = DateTime.Parse("Jul 31, 2014") },
                        new Stop() { Order = 10, Latitude =  51.508515, Longitude =  -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Aug 1, 2014") },
                        new Stop() { Order = 11, Latitude =  55.953252, Longitude =  -3.188267, Name = "Edinburgh, UK", Arrival = DateTime.Parse("Aug 5, 2014") },
                        new Stop() { Order = 12, Latitude =  55.864237, Longitude =  -4.251806, Name = "Glasgow, UK", Arrival = DateTime.Parse("Aug 6, 2014") },
                        new Stop() { Order = 13, Latitude =  57.149717, Longitude =  -2.094278, Name = "Aberdeen, UK", Arrival = DateTime.Parse("Aug 7, 2014") },
                        new Stop() { Order = 14, Latitude =  55.953252, Longitude =  -3.188267, Name = "Edinburgh, UK", Arrival = DateTime.Parse("Aug 8, 2014") },
                        new Stop() { Order = 15, Latitude =  51.508515, Longitude =  -0.125487, Name = "London, UK", Arrival = DateTime.Parse("Aug 10, 2014") },
                        new Stop() { Order = 16, Latitude =  52.370216, Longitude =  4.895168, Name = "Amsterdam, Netherlands", Arrival = DateTime.Parse("Aug 14, 2014") },
                        new Stop() { Order = 17, Latitude =  48.583148, Longitude =  7.747882, Name = "Strasbourg, France", Arrival = DateTime.Parse("Aug 17, 2014") },
                        new Stop() { Order = 18, Latitude =  46.519962, Longitude =  6.633597, Name = "Lausanne, Switzerland", Arrival = DateTime.Parse("Aug 19, 2014") },
                        new Stop() { Order = 19, Latitude =  46.021073, Longitude =  7.747937, Name = "Zermatt, Switzerland", Arrival = DateTime.Parse("Aug 27, 2014") },
                        new Stop() { Order = 20, Latitude =  46.519962, Longitude =  6.633597, Name = "Lausanne, Switzerland", Arrival = DateTime.Parse("Aug 29, 2014") },
                        new Stop() { Order = 21, Latitude =  53.349805, Longitude =  -6.260310, Name = "Dublin, Ireland", Arrival = DateTime.Parse("Sep 2, 2014") },
                        new Stop() { Order = 22, Latitude =  54.597285, Longitude =  -5.930120, Name = "Belfast, Northern Ireland", Arrival = DateTime.Parse("Sep 7, 2014") },
                        new Stop() { Order = 23, Latitude =  53.349805, Longitude =  -6.260310, Name = "Dublin, Ireland", Arrival = DateTime.Parse("Sep 9, 2014") },
                        new Stop() { Order = 24, Latitude =  47.368650, Longitude =  8.539183, Name = "Zurich, Switzerland", Arrival = DateTime.Parse("Sep 16, 2014") },
                        new Stop() { Order = 25, Latitude =  48.135125, Longitude =  11.581981, Name = "Munich, Germany", Arrival = DateTime.Parse("Sep 19, 2014") },
                        new Stop() { Order = 26, Latitude =  50.075538, Longitude =  14.437800, Name = "Prague, Czech Republic", Arrival = DateTime.Parse("Sep 21, 2014") },
                        new Stop() { Order = 27, Latitude =  51.050409, Longitude =  13.737262, Name = "Dresden, Germany", Arrival = DateTime.Parse("Oct 1, 2014") },
                        new Stop() { Order = 28, Latitude =  50.075538, Longitude =  14.437800, Name = "Prague, Czech Republic", Arrival = DateTime.Parse("Oct 4, 2014") },
                        new Stop() { Order = 29, Latitude =  42.650661, Longitude =  18.094424, Name = "Dubrovnik, Croatia", Arrival = DateTime.Parse("Oct 10, 2014") },
                        new Stop() { Order = 30, Latitude =  42.697708, Longitude =  23.321868, Name = "Sofia, Bulgaria", Arrival = DateTime.Parse("Oct 16, 2014") },
                        new Stop() { Order = 31, Latitude =  45.658928, Longitude =  25.539608, Name = "Brosov, Romania", Arrival = DateTime.Parse("Oct 20, 2014") },
                        new Stop() { Order = 32, Latitude =  41.005270, Longitude =  28.976960, Name = "Istanbul, Turkey", Arrival = DateTime.Parse("Nov 1, 2014") },
                        new Stop() { Order = 33, Latitude =  45.815011, Longitude =  15.981919, Name = "Zagreb, Croatia", Arrival = DateTime.Parse("Nov 11, 2014") },
                        new Stop() { Order = 34, Latitude =  41.005270, Longitude =  28.976960, Name = "Istanbul, Turkey", Arrival = DateTime.Parse("Nov 15, 2014") },
                        new Stop() { Order = 35, Latitude =  50.850000, Longitude =  4.350000, Name = "Brussels, Belgium", Arrival = DateTime.Parse("Nov 25, 2014") },
                        new Stop() { Order = 36, Latitude =  50.937531, Longitude =  6.960279, Name = "Cologne, Germany", Arrival = DateTime.Parse("Nov 30, 2014") },
                        new Stop() { Order = 37, Latitude =  48.208174, Longitude =  16.373819, Name = "Vienna, Austria", Arrival = DateTime.Parse("Dec 4, 2014") },
                        new Stop() { Order = 38, Latitude =  47.497912, Longitude =  19.040235, Name = "Budapest, Hungary", Arrival = DateTime.Parse("Dec 28,2014") },
                        new Stop() { Order = 39, Latitude =  37.983716, Longitude =  23.729310, Name = "Athens, Greece", Arrival = DateTime.Parse("Jan 2, 2015") },
                        new Stop() { Order = 40, Latitude =  -25.746111, Longitude =  28.188056, Name = "Pretoria, South Africa", Arrival = DateTime.Parse("Jan 19, 2015") },
                        new Stop() { Order = 41, Latitude =  43.771033, Longitude =  11.248001, Name = "Florence, Italy", Arrival = DateTime.Parse("Feb 1, 2015") },
                        new Stop() { Order = 42, Latitude =  45.440847, Longitude =  12.315515, Name = "Venice, Italy", Arrival = DateTime.Parse("Feb 9, 2015") },
                        new Stop() { Order = 43, Latitude =  43.771033, Longitude =  11.248001, Name = "Florence, Italy", Arrival = DateTime.Parse("Feb 13, 2015") },
                        new Stop() { Order = 44, Latitude =  41.872389, Longitude =  12.480180, Name = "Rome, Italy", Arrival = DateTime.Parse("Feb 17, 2015") },
                        new Stop() { Order = 45, Latitude =  28.632244, Longitude =  77.220724, Name = "New Delhi, India", Arrival = DateTime.Parse("Mar 4, 2015") },
                        new Stop() { Order = 46, Latitude =  27.700000, Longitude =  85.333333, Name = "Kathmandu, Nepal", Arrival = DateTime.Parse("Mar 10, 2015") },
                        new Stop() { Order = 47, Latitude =  28.632244, Longitude =  77.220724, Name = "New Delhi, India", Arrival = DateTime.Parse("Mar 11, 2015") },
                        new Stop() { Order = 48, Latitude =  22.1667, Longitude =  113.5500, Name = "Macau", Arrival = DateTime.Parse("Mar 21, 2015") },
                        new Stop() { Order = 49, Latitude =  22.396428, Longitude =  114.109497, Name = "Hong Kong", Arrival = DateTime.Parse("Mar 24, 2015") },
                        new Stop() { Order = 50, Latitude =  39.904030, Longitude =  116.407526, Name = "Beijing, China", Arrival = DateTime.Parse("Apr 19, 2015") },
                        new Stop() { Order = 51, Latitude =  22.396428, Longitude =  114.109497, Name = "Hong Kong", Arrival = DateTime.Parse("Apr 24, 2015") },
                        new Stop() { Order = 52, Latitude =  1.352083, Longitude =  103.819836, Name = "Singapore", Arrival = DateTime.Parse("Apr 30, 2015") },
                        new Stop() { Order = 53, Latitude =  3.139003, Longitude =  101.686855, Name = "Kuala Lumpor, Malaysia", Arrival = DateTime.Parse("May 7, 2015") },
                        new Stop() { Order = 54, Latitude =  13.727896, Longitude =  100.524123, Name = "Bangkok, Thailand", Arrival = DateTime.Parse("May 24, 2015") },
                        new Stop() { Order = 55, Latitude =  33.748995, Longitude =  -84.387982, Name = "Atlanta, Georgia", Arrival = DateTime.Parse("Jun 17, 2015") }
                    }
                };

                _context.Trips.Add(worldTrip);
                _context.Stops.AddRange(worldTrip.Stops);

                _context.SaveChanges();
            }
        }
示例#21
0
        public async Task EnsureSeedDataAsync()
        {
            if (await _userManager.FindByEmailAsync("*****@*****.**") == null)
            {
                var newUser = new WorldUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                await _userManager.CreateAsync(newUser, "P@ssw0rd!");
            }
            { }

            if (!_context.Trips.Any())
            {
                var indiaTrip = new Trip()
                {
                    Name     = "India Trip",
                    Created  = DateTime.UtcNow,
                    UserName = "******",
                    Stops    = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Pune", Arrival = new DateTime(2016, 6, 3), Latitude = 18.52522, Longitude = 73.84863, Order = 0
                        },
                        new Stop()
                        {
                            Name = "Delhi", Arrival = new DateTime(2016, 6, 4), Latitude = 28.64321, Longitude = 77.11578, Order = 1
                        },
                        new Stop()
                        {
                            Name = "Mumbai", Arrival = new DateTime(2016, 6, 5), Latitude = 18.94880, Longitude = 72.83056, Order = 2
                        }
                    }
                };

                _context.Trips.Add(indiaTrip);
                _context.Stops.AddRange(indiaTrip.Stops);

                var worldTrip = new Trip()
                {
                    Name     = "World Trip",
                    Created  = DateTime.UtcNow,
                    UserName = "******",
                    Stops    = new List <Stop>()
                    {
                        new Stop()
                        {
                            Name = "Paris", Arrival = new DateTime(2016, 7, 4), Latitude = 48.856614, Longitude = 02.352222, Order = 1
                        },
                        new Stop()
                        {
                            Name = "London", Arrival = new DateTime(2016, 8, 5), Latitude = 51.507351, Longitude = -0.127758, Order = 2
                        },
                        new Stop()
                        {
                            Name = "Bahamas", Arrival = new DateTime(2016, 9, 6), Latitude = 25.034280, Longitude = -77.396280, Order = 2
                        }
                    }
                };

                _context.Trips.Add(worldTrip);
                _context.Stops.AddRange(worldTrip.Stops);

                _context.SaveChanges();
            }
        }