Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, GebruikerContex context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }


            app.UseCors("MyPolicy");
            app.UseSwagger();
            app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "ApiPollsMaartenMichiels v1"); });
            app.UseHttpsRedirection();
            app.UseAuthentication();
            app.UseMvc();

            DBInitializer.Initialize(context);
        }
 public PollController(GebruikerContex context)
 {
     _context = context;
 }
Example #3
0
 public UserService(IOptions <AppSettings> appSettings, GebruikerContex gebruikerContex)
 {
     _appSettings     = appSettings.Value;
     _gebruikerContex = gebruikerContex;
 }
 public VriendController(GebruikerContex context)
 {
     _context = context;
 }
 public GebruikerController(GebruikerContex context, IUserService userService)
 {
     _context     = context;
     _userService = userService;
 }
Example #6
0
        public static void Initialize(GebruikerContex context)
        {
            context.Database.EnsureCreated();
            // Look for any Gebruikers.
            if (context.Gebruikers.Any())
            {
                return;
                // DB has been seeded
            }

            context.Gebruikers.AddRange(
                new Gebruiker {
                Voornaam       = "Maarten", Naam = "Michiels",
                Email          = "*****@*****.**",
                Gebruikersnaam = "mnmpower", Wachtwoord = "R1234-56"
            },

                new Gebruiker {
                Voornaam       = "Sacha", Naam = "Rypens",
                Email          = "*****@*****.**",
                Gebruikersnaam = "sacha", Wachtwoord = "R1234-56"
            },

                new Gebruiker {
                Voornaam       = "Spons", Naam = "De Brerker",
                Email          = "*****@*****.**",
                Gebruikersnaam = "spons", Wachtwoord = "R1234-56"
            },
                new Gebruiker {
                Voornaam       = "Benji", Naam = "Bruyns",
                Email          = "*****@*****.**",
                Gebruikersnaam = "benji", Wachtwoord = "R1234-56"
            }
                );

            context.Polls.AddRange(
                new Poll {
                naam = "Favoriete eten"
            },
                new Poll {
                naam = "Favoriete drinken"
            }
                );

            context.PollOpties.AddRange(
                new PollOptie {
                PollID = 1, Antwoord = "Vol-au-vent"
            },
                new PollOptie {
                PollID = 1, Antwoord = "Hamburgers"
            },
                new PollOptie {
                PollID = 1, Antwoord = "Ovenschotel"
            },
                new PollOptie {
                PollID = 2, Antwoord = "Fanta"
            },
                new PollOptie {
                PollID = 2, Antwoord = "Duvel"
            }
                );

            context.PollGebruikers.AddRange(
                new PollGebruiker {
                PollID = 1, GebruikerID = 1, Beheerder = true
            },
                new PollGebruiker {
                PollID = 1, GebruikerID = 2, Beheerder = false
            },
                new PollGebruiker {
                PollID = 1, GebruikerID = 3, Beheerder = true
            },
                new PollGebruiker {
                PollID = 2, GebruikerID = 1, Beheerder = false
            },
                new PollGebruiker {
                PollID = 2, GebruikerID = 3, Beheerder = false
            },
                new PollGebruiker {
                PollID = 2, GebruikerID = 4, Beheerder = true
            }
                );

            //context.Stemmen.AddRange(
            //    new Stem { GebruikerID = 1, PollOptieID = 2 },
            //    new Stem { GebruikerID = 1, PollOptieID = 4 },
            //    new Stem { GebruikerID = 2, PollOptieID = 2 },
            //    new Stem { GebruikerID = 3, PollOptieID = 1 },
            //    new Stem { GebruikerID = 3, PollOptieID = 5 },
            //    new Stem { GebruikerID = 4, PollOptieID = 5 }
            //    );

            context.Vrienden.AddRange(
                new Vriend {
                VerzenderID = 1, OntvangerID = 4, Bevestigd = true
            },
                new Vriend {
                VerzenderID = 1, OntvangerID = 2, Bevestigd = true
            },
                new Vriend {
                VerzenderID = 1, OntvangerID = 3, Bevestigd = true
            },
                new Vriend {
                VerzenderID = 2, OntvangerID = 3, Bevestigd = true
            },
                new Vriend {
                VerzenderID = 2, OntvangerID = 4, Bevestigd = true
            }
                );

            context.SaveChanges();
        }
Example #7
0
 public StemController(GebruikerContex context)
 {
     _context = context;
 }
 public DashboardController(GebruikerContex context)
 {
     _context = context;
 }