コード例 #1
0
        public async Task ChangeLockStatusAsync(UserLockModel model)
        {
            var user = await userManager.FindByIdAsync(model.Id);

            if (model.IsLock)
            {
                user.LockoutEnd = null;
            }
            else
            {
                user.LockoutEnd = DateTime.Now.AddYears(100);
                await LogOutAsync(user);
            }

            await userManager.UpdateAsync(user);
        }
コード例 #2
0
        public async Task <IActionResult> Lock(UserLockModel model)
        {
            await userService.ChangeLockStatusAsync(model);

            return(Ok());
        }