// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, DemoBackendContext context) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "My Demo API V1"); }); DbInitializer.Initialize(context); }
public static void Initialize(DemoBackendContext context) { context.Database.EnsureCreated(); //if DB doesn't exist, it will auto create the DB. if (context.Employees.Any()) { return; } var employee = new Employee { FirstName = "Joshua", LastName = "Colanggo", DateCreated = DateTime.UtcNow }; context.Add(employee); context.SaveChanges(); }
public CustomerController(DemoBackendContext context) { _context = context; }
public EmployeeRepository(DemoBackendContext context) { _context = context; }