public static async Task PerormPreflightOperations(IWebHost host, string[] args) { if (args.Contains("--seed") || args.Contains("-s")) { using (IServiceScope scope = host.Services.CreateScope()) { IServiceProvider services = scope.ServiceProvider; BudgetTrackerContext context = services.GetRequiredService <BudgetTrackerContext>(); IConfiguration appConfig = services.GetRequiredService <IConfiguration>(); BasicSeed seeder = new BasicSeed(context, appConfig); await seeder.Seed(); } } }
public ServiceBase(BudgetTrackerContext context, IJwtService jwtService) { _context = context; _jwtService = jwtService; }
public IncomeService(BudgetTrackerContext context, IJwtService jwtService) : base(context, jwtService) { }
public CategoryService(BudgetTrackerContext context, IJwtService jwtService) : base(context, jwtService) { }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, UserManager <User> userManager, BudgetTrackerContext context) { if (env.IsDevelopment()) { app.UseCors(builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseDeveloperExceptionPage(); } else { app.UseCors(builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); app.UseHsts(); app.UseHttpsRedirection(); } app.UseOpenApi(options => { options.DocumentName = "swagger"; options.Path = "/swagger/v1/swagger.json"; options.PostProcess = (document, _) => { document.Schemes.Add(OpenApiSchema.Https); }; }); app.UseRouting(); app.UseSwaggerUi3(options => { options.DocumentPath = "/swagger/v1/swagger.json"; }); app.UseAuthentication(); app.UseAuthorization(); DatabaseSeeder.SeedData(userManager, context); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public AuthenticationService(BudgetTrackerContext context, SignInManager <User> signInManager, UserManager <User> userManager, IJwtService jwtService) : base(context, jwtService) { _signInManager = signInManager; _userManager = userManager; }
public JwtService(IOptions <AppSettings> appSettings, IHttpContextAccessor httpContextAccessor, BudgetTrackerContext context) { _appSettings = appSettings.Value; _context = context; _token = httpContextAccessor.HttpContext.Request.Headers["Authorization"]; }
public ExpenseService(BudgetTrackerContext context, IJwtService jwtService) : base(context, jwtService) { }