Exemplo n.º 1
0
        public static void Seed(GeoPetContext context)
        {
            if (context.Database.EnsureCreated())
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Roberto1",
                    Password = "******",
                    Phone = "11111"
                }));

                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2015, 12, 17),
                    Color = "Blanco",
                    Email = "*****@*****.**",
                    ImageUrl = "www.image.com/1234",
                    Name = "Firulais",
                    Race = "Cocker",
                    Type = "Perro"
                }));

                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
 public static GeoPetContext GetInstance()
 {
     if (_instance == null)
     {
         _instance = new GeoPetContext();
         _instance.Database.EnsureCreated();
     }
     return(_instance);
 }
Exemplo n.º 3
0
        public static void SeedTestData(GeoPetContext context)
        {
            if (context.Owners.IsEmpty())
            {
                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Juan",
                    Password = "******",
                    Phone = "099000000"
                }));

                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Fabrizio",
                    Password = "******",
                    Phone = "099111111"
                }));

                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Diego",
                    Password = "******",
                    Phone = "099222222"
                }));

                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Sebastian",
                    Password = "******",
                    Phone = "099333333"
                }));

                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Patricia",
                    Password = "******",
                    Phone = "099444444"
                }));

                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Carlos",
                    Password = "******",
                    Phone = "099555555"
                }));

                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Santiago",
                    Password = "******",
                    Phone = "099666666"
                }));

                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Jonathan",
                    Password = "******",
                    Phone = "099777777"
                }));

                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Fernando",
                    Password = "******",
                    Phone = "099888888"
                }));

                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Mauro",
                    Password = "******",
                    Phone = "099999999"
                }));

                context.Owners.Add((new Owner
                {
                    Mail = "*****@*****.**",
                    Name = "Mariana",
                    Password = "******",
                    Phone = "096000000"
                }));

                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2014, 1, 8),
                    Color = "Marron",
                    Email = "*****@*****.**",
                    ImageUrl =
                        "https://cdn20.patchcdn.com/users/22942932/20171024/101603/styles/T800x600/public/processed_images/starsky-1508854517-6249.jpg",
                    Name = "Buky",
                    Race = "Labrador",
                    Type = "Perro"
                }));

                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2015, 12, 17),
                    Color = "Negro",
                    Email = "*****@*****.**",
                    ImageUrl =
                        "https://cdn20.patchcdn.com/users/22942932/20180320/025242/styles/T800x600/public/processed_images/savannah-1521571046-1688.jpg",
                    Name = "Pochi",
                    Race = "Siames",
                    Type = "Perro"
                }));

                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2013, 11, 5),
                    Color = "Beige",
                    Email = "*****@*****.**",
                    ImageUrl =
                        "https://iheartdogs.com/wp-content/uploads/2017/08/2936080986_0cf1f4ccf6_z-e1502221794694.jpg",
                    Name = "Tommy",
                    Race = "Salchicha",
                    Type = "Perro"
                }));

                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2010, 7, 2),
                    Color = "Negro",
                    Email = "*****@*****.**",
                    ImageUrl =
                        "https://freerangestock.com/sample/30203/tricolor-female-cat-portraitanimals-cat-cats-pet-pets-portrait-background.jpg",
                    Name = "Cachete",
                    Race = "Bengala",
                    Type = "Gato"
                }));

                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2018, 7, 13),
                    Color = "Blanco",
                    Email = "*****@*****.**",
                    ImageUrl = "http://www.freepressjournal.in/wp-content/uploads/2017/10/Pets-in-Diwali.jpg",
                    Name = "Indio",
                    Race = "Labrador",
                    Type = "Perro"
                }));

                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2013, 10, 10),
                    Color = "Marron",
                    Email = "*****@*****.**",
                    ImageUrl = "https://cdn2.lamag.com/wp-content/uploads/sites/6/2016/10/RealDog.jpg",
                    Name = "Pelo",
                    Race = "Beige",
                    Type = "Perro"
                }));

                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2017, 8, 2),
                    Color = "Blanco",
                    Email = "*****@*****.**",
                    ImageUrl = "https://i.ytimg.com/vi/gRj66oBuRnQ/hqdefault.jpg",
                    Name = "Mauro",
                    Race = "Ragdoll",
                    Type = "Gato"
                }));

                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2017, 8, 2),
                    Color = "Negro",
                    Email = "*****@*****.**",
                    ImageUrl =
                        "https://bloximages.chicago2.vip.townnews.com/tucson.com/content/tncms/assets/v3/editorial/7/a3/7a3a4d0a-74db-11e8-9389-7bcb129bc2d3/5b2ad8e89e4de.image.jpg",
                    Name = "Fabrizio",
                    Race = "SinRazaDefinida",
                    Type = "Perro"
                }));


                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2014, 9, 9),
                    Color = "Amarillo",
                    Email = "*****@*****.**",
                    ImageUrl = "https://probonoaustralia.com.au/wp-content/uploads/2016/09/Jetpets-6.jpg",
                    Name = "Santiago",
                    Race = "Collie",
                    Type = "Perro"
                }));

                context.Pets.Add((new Pet
                {
                    Birthdate = new DateTime(2015, 8, 8),
                    Color = "Gris",
                    Email = "*****@*****.**",
                    ImageUrl = "http://images.meteociel.fr/im/6311/Siberian-Husky-1_bgi0.jpg",
                    Name = "Diego",
                    Race = "Huskie",
                    Type = "Perro"
                }));

                context.SaveChanges();
            }
        }