Пример #1
0
        public virtual IdentityManagerResult SetLockedOut(TUser user, bool locked)
        {
            if (locked)
            {
                var result = userManager.SetLockoutEndDate(user.Id, DateTimeOffset.MaxValue);
                if (!result.Succeeded)
                {
                    return(new IdentityManagerResult(result.Errors.First()));
                }
            }
            else
            {
                var result = userManager.SetLockoutEndDate(user.Id, DateTimeOffset.MinValue);
                if (!result.Succeeded)
                {
                    return(new IdentityManagerResult(result.Errors.First()));
                }
            }

            return(IdentityManagerResult.Success);
        }