Пример #1
0
        /// <summary>
        /// Deltes a role from the Roles table
        /// </summary>
        /// <param name="roleId">The role Id</param>
        /// <returns></returns>
        public int Delete(string roleId)
        {
            string commandText = "Delete from Roles where Id = @id";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@id", roleId);

            return(_database.Execute(commandText, parameters));
        }
Пример #2
0
        /// <summary>
        /// Deletes all roles from a user in the UserRoles table
        /// </summary>
        /// <param name="userId">The user's id</param>
        /// <returns></returns>
        public int Delete(string userId)
        {
            string commandText = "Delete from UserRoles where UserId = @userId";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("UserId", userId);

            return(_database.Execute(commandText, parameters));
        }
Пример #3
0
        /// <summary>
        /// Sets the user's password hash
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="passwordHash"></param>
        /// <returns></returns>
        public int SetPasswordHash(string userId, string passwordHash)
        {
            string commandText = "Update Users set PasswordHash = @pwdHash where Id = @id";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@pwdHash", passwordHash);
            parameters.Add("@id", userId);

            return(_database.Execute(commandText, parameters));
        }
Пример #4
0
        /// <summary>
        /// Deletes a login from a user in the UserLogins table
        /// </summary>
        /// <param name="user">User to have login deleted</param>
        /// <param name="login">Login to be deleted from user</param>
        /// <returns></returns>
        public int Delete(IdentityUser user, UserLoginInfo login)
        {
            string commandText = "Delete from UserLogins where UserId = @userId and LoginProvider = @loginProvider and ProviderKey = @providerKey";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("UserId", user.Id);
            parameters.Add("loginProvider", login.LoginProvider);
            parameters.Add("providerKey", login.ProviderKey);

            return(_database.Execute(commandText, parameters));
        }