Example #1
0
        public async Task <ActionResult> Remove(string userName)
        {
            using (UserDefinitionDataProvider dataProvider = new UserDefinitionDataProvider()) {
                UserDefinition user = await GetUserAsync(userName, dataProvider);

                await dataProvider.RemoveItemAsync(userName);

                return(Reload(null, Reload: ReloadEnum.ModuleParts));
            }
        }
Example #2
0
        public async Task <IdentityResult> DeleteAsync(UserDefinition user, CancellationToken cancellationToken)
        {
            using (UserDefinitionDataProvider dataProvider = new UserDefinitionDataProvider(this.CurrentSiteIdentity)) {
                bool status = await dataProvider.RemoveItemAsync(user.UserName);

                if (!status)
                {
                    throw new Error(this.__ResStr("userNotFound", "User {0} not found.", user.UserName));
                }
                return(IdentityResult.Success);
            }
        }
        public async Task <bool> RemoveUserAsync(int userId)
        {
            using (UserDefinitionDataProvider userDP = new UserDefinitionDataProvider()) {
                UserDefinition user = await userDP.GetItemByUserIdAsync(userId);

                if (user == null)
                {
                    return(false);
                }
                return(await userDP.RemoveItemAsync(user.UserName));
            }
        }