Пример #1
0
        public static void Initialize(AngularContext context)
        {
            context.Database.EnsureCreated();

            if (context.Gebruikers.Any())
            {
                return;
            }
            var salt       = HashService.GenerateSalt();
            var gebruikers = new Gebruiker[]
            {
                new Gebruiker(context)
                {
                    Gebruikersnaam = "Wesley",
                    Email          = "*****@*****.**",
                    Salt           = salt,
                    Wachtwoord     = HashService.Create("wesley", salt),
                    ImageUrl       = "https://res.cloudinary.com/dnjmym7yo/image/upload/v1574867798/profile_q2bu5r.png"
                },
                new Gebruiker(context)
                {
                    Gebruikersnaam = "SirTurtle",
                    Email          = "*****@*****.**",
                    Salt           = salt,
                    Wachtwoord     = HashService.Create("sirturtle", salt),
                    ImageUrl       = "https://res.cloudinary.com/dnjmym7yo/image/upload/v1574867798/profile_q2bu5r.png"
                },

                new Gebruiker(context)
                {
                    Gebruikersnaam = "SirFailure",
                    Email          = "*****@*****.**",
                    Salt           = salt,
                    Wachtwoord     = HashService.Create("sirfailure", salt),
                    ImageUrl       = "https://res.cloudinary.com/dnjmym7yo/image/upload/v1574867798/profile_q2bu5r.png"
                },

                new Gebruiker(context)
                {
                    Gebruikersnaam = "Ali",
                    Email          = "*****@*****.**",
                    Salt           = salt,
                    Wachtwoord     = HashService.Create("ali123", salt),
                    ImageUrl       = "https://res.cloudinary.com/dnjmym7yo/image/upload/v1574867798/profile_q2bu5r.png"
                },
                new Gebruiker(context)
                {
                    Gebruikersnaam = "Din",
                    Email          = "*****@*****.**",
                    Salt           = salt,
                    Wachtwoord     = HashService.Create("din123", salt),
                    ImageUrl       = "https://res.cloudinary.com/dnjmym7yo/image/upload/v1574867798/profile_q2bu5r.png"
                },

                new Gebruiker(context)
                {
                    Gebruikersnaam = "Lenny",
                    Email          = "*****@*****.**",
                    Salt           = salt,
                    Wachtwoord     = HashService.Create("lenny123", salt),
                    ImageUrl       = "https://res.cloudinary.com/dnjmym7yo/image/upload/v1574867798/profile_q2bu5r.png"
                },
            };

            foreach (Gebruiker g in gebruikers)
            {
                context.Gebruikers.Add(g);
            }

            context.SaveChanges();
        }
Пример #2
0
 public Gebruiker(AngularContext context)
 {
     this.context = context;
 }