public static async Task CreateAdminRoleAndUser(AdminDbContext dbContext, IAdminRepositoryDb repo) { ApplicationRole adminRole = new ApplicationRole { Id = "1", Name = "SystemAdministrator", NormalizedName = "SystemAdministrator" }; if (!await repo.RoleExistsAsync(adminRole.Name)) { await repo.CreateRolesAsync(adminRole); } ApplicationUser user_Admin = new ApplicationUser { SecurityStamp = Guid.NewGuid().ToString(), UserName = "******", Email = "*****@*****.**", NormalizedUserName = "******" }; if (await repo.FindUserByEmailAsync(user_Admin.Email) == null) { await repo.CreateUserAsync(user_Admin, "Diplo1!"); await repo.AddUserDefaultRoleAsync(user_Admin, adminRole.Name); // Remove Lockout and E-Mail confirmation. user_Admin.EmailConfirmed = true; user_Admin.LockoutEnabled = false; } await dbContext.SaveChangesAsync(); }
public BlobController(IAzureBlobService azureBlobService, IOptions <AppSettings> options, IAdminRepositoryDb adminRepositoryDb, IFileManager fileManager) : base(adminRepositoryDb, options) { this.azureBlobService = azureBlobService; this.options = options; this.fileManager = fileManager; this.adminRepositoryDb = adminRepositoryDb; }
public static void Seed(AdminDbContext dbContext, IAdminRepositoryDb repo) { if (!dbContext.Users.Any()) { CreateAdminRoleAndUser(dbContext, repo) .GetAwaiter() .GetResult(); } }
public BaseApiController( IAdminRepositoryDb repo, IOptions <AppSettings> options) { // Instantiate the required classes through DI this.adminRepositoryDb = repo; this.options = options; // Instantiate a single JsonSerializerSettings object // that can be reused multiple times. this.JsonSettings = new JsonSerializerSettings() { Formatting = Formatting.Indented }; }
public EntityDataTypeLogic(IAdminRepositoryDb repo) { this.Repository = repo; }
public LogController(ILogLogic logic, IAdminRepositoryDb repo) { this.logic = logic; this.repo = repo; }
public LogLogic(IAdminRepositoryDb repo) { this.repo = repo; }