public TodoController(WhatsThatGameProdContext context) { _context = context; if (!_context.Game.Any()) { //_context.Game.Add(new Game { Title = "TPA" , Description = "Pinball game" , Year = 2013}); //_context.Game.Add(new Game { Title = "KCD" , Description = "Medieval game", Year = 2018 }); //_context.SaveChanges(); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, WhatsThatGameProdContext db) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseStatusCodePages(); } else { //app.UseHsts(); } db.Database.Migrate(); app.UseCors(builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); // app.UseHttpsRedirection(); app.UseMvc(); }