/// <summary> /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. /// </summary> /// <param name="app"></param> /// <param name="env"></param> /// <param name="loggerFactory"></param> /// <param name="accountsService"></param> /// <param name="applicationDbContext"></param> /// <param name="deliveryServiceApiContext"></param> public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IAccountsService accountsService, ApplicationDbContext applicationDbContext, DeliveryServiceApiContext deliveryServiceApiContext) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); // Add some test data in development if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); // ===== Add test roles and users ====== ApplicationDummyData.AddDummyUsersAsync(accountsService).Wait(); // ===== Add some test data in development ====== DeliveryServiceApiDummyData.AddDummyData(deliveryServiceApiContext); } app.Use(async(context, next) => { if (context.Request.IsHttps) { await next(); } else { var sslPortStr = string.Empty; if (_httpsPort != null && _httpsPort != 0 && _httpsPort != 443) { sslPortStr = $":{_httpsPort}"; } var httpsUrl = $"https://{context.Request.Host.Host}{sslPortStr}{context.Request.Path}"; context.Response.Redirect(httpsUrl); } }); // 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", "Deliver Service API V1"); }); // ===== Use Authentication ====== app.UseAuthentication(); app.UseMvc(); // ===== Create tables ====== applicationDbContext.Database.EnsureCreated(); }
public Graph(DeliveryServiceApiContext context) { _context = context; }
/// <summary> /// Class constructor /// </summary> /// <param name="context"></param> public RoutesService(DeliveryServiceApiContext context) { _context = context; }
/// <summary> /// Class constructor /// </summary> /// <param name="context"></param> public PointsService(DeliveryServiceApiContext context) { _context = context; }