public static void Initialize(ActividadesComplementariasContext context) { context.Database.EnsureCreated(); if (context.estado.Any()) { return; } var estado = new estado[] { // }; foreach (estado a in estado) { context.estado.Add(a); } 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, ActividadesComplementariasContext context) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); DbInitializer.Initialize(context); }
public estadoesController(ActividadesComplementariasContext context) { _context = context; }