// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, _dbContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseCors("General"); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); if (!context.Categorias.Any()) { context.Categorias.AddRange(new List <Categoria>() { new Categoria() { categoria = "Nacional" }, new Categoria() { categoria = "Internacional" } }); } if (!context.Clientes.Any()) { context.Clientes.AddRange(new List <Cliente>() { new Cliente() { categoriaID = 1, nombres = "Juan", apellidos = "Lopez" }, new Cliente() { categoriaID = 2, nombres = "Maria", apellidos = "Perez" } }); } context.SaveChanges(); }
public ClientesController(_dbContext context) { _context = context; }
public CategoriasController(_dbContext context) { _context = context; }