Beispiel #1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && _userManager != null)
            {
                _userManager.Dispose();
                _userManager = null;
            }

            base.Dispose(disposing);
        }
Beispiel #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_userManager != null)
                {
                    _userManager.Dispose();
                    _userManager = null;
                }

                if (_signInManager != null)
                {
                    _signInManager.Dispose();
                    _signInManager = null;
                }
            }

            base.Dispose(disposing);
        }
        /// <summary>
        /// akcja dodania usera
        /// </summary>
        /// <returns></returns>
        public async Task <string> AddUser()
        {
            MyApplicationUser        user;
            MyApplicationUserStore   Store       = new MyApplicationUserStore(new MyApplicationDbContext()); //(MyApplicationUserStore)(new UserStore<MyApplicationUser>(new MyApplicationDbContext()));  //-to samo robi
            MyApplicationUserManager userManager = new MyApplicationUserManager(Store);

            user = new MyApplicationUser
            {
                UserName      = "******",
                Email         = "*****@*****.**",
                DataUrodzenia = DateTime.Parse("1990-05-25")
            };

            var result = await userManager.CreateAsync(user);

            if (!result.Succeeded)
            {
                return(result.Errors.First());
            }
            return("User Added");
        }
Beispiel #4
0
 public ManageController(MyApplicationUserManager userManager, MyApplicationSignInManager signInManager)
 {
     UserManager   = userManager;
     SignInManager = signInManager;
 }
 public UserPageController(MyApplicationUserManager userManager, MyApplicationRoleManager roleManager)
 {
     UserManager = userManager;
     RoleManager = roleManager;
 }