Пример #1
0
        /// <summary>
        /// Removes a user from a role.
        /// </summary>
        /// <param name="user">TUser object.</param>
        /// <param name="role">Role string.</param>
        /// <returns></returns>
        public Task RemoveFromRoleAsync(TUser user, string role)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            if (role == null)
            {
                throw new ArgumentNullException("login");
            }

            string roleId = roleTable.GetRoleId(role);

            if (!string.IsNullOrEmpty(roleId))
            {
                userRolesTable.Delete(user.Id, roleId);
            }

            return(Task.FromResult <object>(null));
        }
Пример #2
0
        /// <summary>
        /// Removes a user from a role.
        ///
        /// Created by Slawomir Figiel
        /// </summary>
        /// <param name="user">IdentityUser Object.</param>
        /// <param name="role">Role String.</param>
        /// <returns></returns>
        public Task RemoveFromRoleAsync(IdentityUser user, String role)
        {
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            if (role == null)
            {
                throw new ArgumentNullException(nameof(role));
            }

            String roleId = _roleTable.GetRoleId(role);

            if (!String.IsNullOrEmpty(roleId))
            {
                _userRolesTable.Delete(user.Id, roleId);
            }

            return(Task.FromResult <Object>(null));
        }