Пример #1
0
        protected override void Seed(WebDiskDbContext context)
        {
            var    passwordHash = new PasswordHasher();
            var    realPassword = "******";
            string password     = passwordHash.HashPassword(realPassword);
            var    temporaryId  = Guid.NewGuid();
            var    userToCreate = new ApplicationUser
            {
                Id       = temporaryId,
                UserName = "******",
                Email    = "*****@*****.**",
                Space    = new Space()
                {
                    Directory = new Field()
                    {
                        Name             = "root",
                        Type             = DatabaseModel.Types.FieldType.Directory,
                        LastModifiedDate = DateTime.Now,
                        FieldId          = temporaryId
                    },
                    IsEnabled          = true,
                    DefaultDirectoryId = temporaryId,
                    SpaceId            = temporaryId
                },
                PasswordHash   = password,
                PhoneNumber    = "798740944",
                EmailConfirmed = true
            };

            context.Users.AddOrUpdate(u => u.UserName, userToCreate);


            if (!context.Users.Any(n => n.UserName == "konrad.dysput"))
            {
                var userStore = new UserStore <ApplicationUser,
                                               DatabaseModel.Identity.CustomRole,
                                               Guid,
                                               DatabaseModel.Identity.IdentityUserLogin,
                                               DatabaseModel.Identity.IdentityUserRole,
                                               DatabaseModel.Identity.IdentityUserClaim>(context);
                var userManager = new UserManager <ApplicationUser, Guid>(userStore);
                var result      = userManager.Create(userToCreate, realPassword);
                //var context
            }
        }
Пример #2
0
 public FieldService(WebDiskDbContext context) : base(context)
 {
 }
Пример #3
0
 public SpaceService(WebDiskDbContext context) : base(context)
 {
 }
        public static ApplicationUser FindById(this UserManager <ApplicationUser, Guid> userManager, Guid id)
        {
            var dbContext = new WebDiskDbContext();

            return(dbContext.Users.FirstOrDefault(n => n.Id == id));
        }
 public AuthenticationManager(WebDiskDbContext context)
 {
     _userRepository  = new Repository <ApplicationUser>(context);
     _fieldRepository = new Repository <Field>(context);
 }
Пример #6
0
 public IdentityUserStorage(WebDiskDbContext context)
     : base(context)
 {
 }
Пример #7
0
 public IdentityRoleStore(WebDiskDbContext context)
     : base(context)
 {
 }
Пример #8
0
 public DirectoryService(WebDiskDbContext context) : base(context)
 {
 }
Пример #9
0
 public ServiceBase()
 {
     _context     = new WebDiskDbContext();
     _authManager = new AuthenticationManager(_context);
 }
Пример #10
0
 public ServiceBase(WebDiskDbContext context)
 {
     _context     = context;
     _authManager = new AuthenticationManager(_context);
 }
Пример #11
0
 public Repository()
 {
     _context = new WebDiskDbContext();
     dbSet    = _context.Set <TEntity>();
 }
Пример #12
0
 public Repository(WebDiskDbContext context)
 {
     _context = context;
     dbSet    = _context.Set <TEntity>();
 }