Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseMvc();

            app.UseSwagger();

            app.UseSwaggerUI(options =>
                             options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
                             );

            NDCOsloData.Seed(app.ApplicationServices);
        }
        public async Task <IActionResult> ResetDatabase()
        {
            if (_hostingEnvironment.IsDevelopment())
            {
                await NDCOsloData.Recreate(_applicationDbContext);

                return(Accepted());
            }
            else
            {
                return(Forbid());
            }
        }
Exemple #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseCors(policy => policy.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());

            app.UseSwagger();

            app.UseSwaggerUI(options =>
                             options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
                             );

            app.UseMvc();

            app.Run(context =>
            {
                context.Response.Redirect("/swagger");
                return(Task.CompletedTask);
            });

            NDCOsloData.Seed(app.ApplicationServices);
        }
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }

            app.UseSwagger();

            app.UseSwaggerUI(options =>
                             options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
                             );

            app.UseMvc();

            app.Run(context =>
            {
                context.Response.Redirect("/swagger");
                return(Task.CompletedTask);
            });

            NDCOsloData.Seed(app.ApplicationServices);
        }