// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, DocUpContext dbContext) { dbContext?.Database.Migrate(); SeedingExtension.EnsureAdminCreated(dbContext); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "DocUp v1")); } app.UseCors(builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); //app.UseMiddleware<LoggingMiddleware>(); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
internal static void EnsureAdminCreated(DocUpContext context) { var adminUser = context.Accounts.Any(x => x.Email == "*****@*****.**" && x.Login == "admin"); if (!adminUser) { context.Accounts.Add(new AccountEntity { Email = "*****@*****.**", Login = "******", PasswordHash = PasswordHash.CreateHash("admin"), Role = Roles.Admin, }); } context.SaveChanges(); }
public ClinicStorage(DocUpContext dbContext) { _dbContext = dbContext; }
public PatientStorage(DocUpContext dbContext) { _dbContext = dbContext; }
public AccountStorage(DocUpContext dbContext) { _dbContext = dbContext; }
public DoctorStorage(DocUpContext dbContext) { _dbContext = dbContext; }
public IlnessStorage(DocUpContext dbContext) { _dbContext = dbContext; }
public DeviceStorage(DocUpContext dbContext) { _dbContext = dbContext; }