public GameTests() { var dbOption = new DbContextOptionsBuilder <CityCheckContext>() .UseMySql("server=localhost;port=3306;database=CityCheckDB;uid=root;password=12345;") .Options; context = new CityCheckContext(dbOption); gmController = new GameController(context); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, CityCheckContext CCcontext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.UseMvc(); app.UseCors("CorsPolicy"); DBInitializer.Initialize(CCcontext); }
public TeamController(CityCheckContext context) { this.context = context; this.teamMethods = new TeamMethods(context); }
public TeamMethods(CityCheckContext context) { this.context = context; }
public GameController(CityCheckContext context) { this.context = context; this.gameMethods = new GameMethods(context); }
public DoelMethod(CityCheckContext context) { this.context = context; }
public static void Initialize(CityCheckContext context) { //create the db is not exist yet context.Database.EnsureCreated(); //Default wat doellocaties al in de db steken //zijn er al doellocaties? if (!context.DoelLocaties.Any()) { //er zijn nog geen doellocaties //We steken er standaard een aantal belangrijke in. var doel = new DoelLocatie(); var loc = new Locatie(); //Antwoorden instellen var ant1 = new Antwoord(); ant1.CorrectBool = false; ant1.Antwoordzin = "Groenplaats"; var ant2 = new Antwoord(); ant2.CorrectBool = true; ant2.Antwoordzin = "Eilandje"; var ant3 = new Antwoord(); ant3.CorrectBool = false; ant3.Antwoordzin = "Rooseveld"; //Vraag toevoegen var ques = new Vraag(); ques.VraagZin = "Waar zijn we?"; ques.Antwoorden = new System.Collections.Generic.List <Antwoord>(); ques.Antwoorden.Add(ant1); ques.Antwoorden.Add(ant2); ques.Antwoorden.Add(ant3); //mas doel.Titel = "Mas"; loc.Lat = 51.2289238; loc.Long = 4.4026316; doel.locatie = loc; doel.Vragen = new System.Collections.Generic.List <Vraag>(); doel.Vragen.Add(ques); context.DoelLocaties.Add(doel); context.SaveChanges(); //centraal station doel = new DoelLocatie(); loc = new Locatie(); doel.Titel = "Centraal Station"; loc.Lat = 51.2183305; loc.Long = 4.4204524; doel.locatie = loc; context.DoelLocaties.Add(doel); context.SaveChanges(); //kathedraal doel = new DoelLocatie(); loc = new Locatie(); doel.Titel = "OlvKathedraal"; loc.Lat = 51.2202678; loc.Long = 4.399327; doel.locatie = loc; context.DoelLocaties.Add(doel); context.SaveChanges(); //het steen doel = new DoelLocatie(); loc = new Locatie(); doel.Titel = "Steen"; loc.Lat = 51.2227238; loc.Long = 4.395175; doel.locatie = loc; context.DoelLocaties.Add(doel); context.SaveChanges(); //Hendrik Conscienceplein doel = new DoelLocatie(); loc = new Locatie(); doel.Titel = "Hendrik Conscienceplein"; loc.Lat = 51.2211204; loc.Long = 4.4021283; doel.locatie = loc; context.DoelLocaties.Add(doel); context.SaveChanges(); //Groenplaats doel = new DoelLocatie(); loc = new Locatie(); doel.Titel = "Groenplaats"; loc.Lat = 51.2189511; loc.Long = 4.3989123; doel.locatie = loc; context.DoelLocaties.Add(doel); context.SaveChanges(); //Boerentoren doel = new DoelLocatie(); loc = new Locatie(); doel.Titel = "Boerentoren"; loc.Lat = 51.2185463; loc.Long = 4.4042931; doel.locatie = loc; context.DoelLocaties.Add(doel); context.SaveChanges(); //demo stuff doel = new DoelLocatie(); loc = new Locatie(); doel.Titel = "Demo1"; loc.Lat = 51.2202678; loc.Long = 4.399327; doel.locatie = loc; context.DoelLocaties.Add(doel); context.SaveChanges(); doel = new DoelLocatie(); loc = new Locatie(); doel.Titel = "Demo2"; loc.Lat = 51.2202678; loc.Long = 4.399327; doel.locatie = loc; context.DoelLocaties.Add(doel); context.SaveChanges(); doel = new DoelLocatie(); loc = new Locatie(); doel.Titel = "Demo3"; loc.Lat = 51.2202678; loc.Long = 4.399327; doel.locatie = loc; context.DoelLocaties.Add(doel); context.SaveChanges(); //if } }
public GameMethods(CityCheckContext context) { this.context = context; }
public DoelController(CityCheckContext context) { this.context = context; this.doelMethods = new DoelMethod(context); }