public static void SeedData(this KentNoteBookDbContext db)
        {
            if (!db.Users.Any())
            {
                var saltString = Crypto.GeneratePasswordSalt();

                db.Users.Add(new SystemUser {
                    Id           = Guid.NewGuid(),
                    Name         = "Admin",
                    NickName     = "Admin",
                    PasswordSalt = saltString,
                    Password     = Crypto.HashPassword(saltString, "123456"),
                    Email        = "*****@*****.**",
                    Mobile       = "13811111111",
                    IsActive     = true,
                    Status       = Status.Enabled
                });

                for (int i = 0; i < 30; i++)
                {
                    saltString = Crypto.GeneratePasswordSalt();
                    db.Users.Add(new SystemUser {
                        Id           = Guid.NewGuid(),
                        Name         = "User" + i,
                        NickName     = "User " + i,
                        PasswordSalt = saltString,
                        Password     = Crypto.HashPassword(saltString, "123456"),
                        Email        = "*****@*****.**",
                        Mobile       = "13811111111",
                        IsActive     = true,
                        Status       = Status.Enabled
                    });
                }
            }

            db.SaveChanges();
        }
Пример #2
0
 public AuthController(KentNoteBookDbContext db, IConfiguration configuration)
 {
     _db            = db;
     _configuration = configuration;
 }
Пример #3
0
 public RoleEditModel(KentNoteBookDbContext db)
 {
     this._db = db;
 }
Пример #4
0
 public PermissionEditModel(KentNoteBookDbContext db)
 {
     this._db = db;
 }
Пример #5
0
 public FileUploadController(KentNoteBookDbContext db, IConfiguration configuration, IHostingEnvironment hostingEnv)
 {
     _db            = db;
     _configuration = configuration;
     _hostingEnv    = hostingEnv;
 }
Пример #6
0
 public SystemRolesModel(KentNoteBookDbContext db)
 {
     this._db = db;
 }
Пример #7
0
 public MenusModel(KentNoteBookDbContext db, IDistributedCache cache)
 {
     this._db    = db;
     this._cache = cache;
 }
Пример #8
0
 public ProfileModel(KentNoteBookDbContext db)
 {
     this._db = db;
 }
 public MenuTreeModel(KentNoteBookDbContext db)
 {
     this._db = db;
 }
Пример #10
0
 public DataPermissionsModel(KentNoteBookDbContext db)
 {
     this._db = db;
 }
Пример #11
0
 public UsersModel(KentNoteBookDbContext db)
 {
     this._db = db;
 }
Пример #12
0
 public LoginModel(KentNoteBookDbContext db, IConfiguration configuration, IDistributedCache cache)
 {
     this._db            = db;
     this._configuration = configuration;
     this._cache         = cache;
 }