Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, InitiativesPlusDbContext context, Seed seeder)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                // Seed users
                seeder.SeedUsers();
            }

            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();

            // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
            // specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "InitiativesPLUS API V1");
                c.RoutePrefix = string.Empty;
            });


            app.UseHttpsRedirection();

            app.UseRouting();

            // Migrate any database changes on startup (includes initial db creation)
            context.Database.Migrate();

            app.UseCors(MyAllowAnyOrigin);
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
 public ActionRepository(InitiativesPlusDbContext context)
 {
     _context = context;
 }
 public UserRepository(InitiativesPlusDbContext context)
 {
     _context = context;
 }
Esempio n. 4
0
 public Seed(InitiativesPlusDbContext context)
 {
     _context = context;
 }