Beispiel #1
0
        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();
        }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 public static void Seed(AdminDbContext dbContext, IAdminRepositoryDb repo)
 {
     if (!dbContext.Users.Any())
     {
         CreateAdminRoleAndUser(dbContext, repo)
         .GetAwaiter()
         .GetResult();
     }
 }
Beispiel #4
0
        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
            };
        }
Beispiel #5
0
 public EntityDataTypeLogic(IAdminRepositoryDb repo)
 {
     this.Repository = repo;
 }
Beispiel #6
0
 public LogController(ILogLogic logic, IAdminRepositoryDb repo)
 {
     this.logic = logic;
     this.repo  = repo;
 }
Beispiel #7
0
 public LogLogic(IAdminRepositoryDb repo)
 {
     this.repo = repo;
 }