Пример #1
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              ILoggerFactory loggerFactory, ScheduleContext scheduleContext)
        {
            loggerFactory.AddNLog();

            app.UseSwagger();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler();
            }

            scheduleContext.EnsureSeedDataForContext();

            app.UseStatusCodePages();

            AutoMapper.Mapper.Initialize(config =>
            {
                config.CreateMap <Schedule, ScheduleViewModel>().ReverseMap();
                config.CreateMap <Schedule, Schedule>();
            });

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "TimeTable API V1");
            });

            app.UseAuthentication();

            app.UseMvc();
        }