/// <summary> /// Deletes all roles from a user in the AspNetUserRoles table. /// </summary> /// <param name="userId">The user's id.</param> /// <returns></returns> public int Delete(string userId) { string commandText = "DELETE FROM " + fullTableName + " WHERE " + fieldUserID.Quoted() + " = @userId"; Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("userId", userId); return(_database.Execute(commandText, parameters)); }
/// <summary> /// Deletes all claims from a user given a userId. /// </summary> /// <param name="userId">The user's id.</param> /// <returns></returns> public int Delete(string userId) { string commandText = "DELETE FROM \"AspNetUserClaims\" WHERE \"UserId\" = @userId"; Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("userId", userId); return(_database.Execute(commandText, parameters)); }
/// <summary> /// Deletes a role record from the AspNetRoles table. /// </summary> /// <param name="roleId">The role Id</param> /// <returns></returns> public int Delete(string roleId) { string commandText = "DELETE FROM AspNetRoles WHERE Id = @id"; Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("@id", roleId); return(_database.Execute(commandText, parameters)); }
/// <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 \"AspNetUsers\" 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)); }
/// <summary> /// Deletes role from a user in the AspNetUserRoles table. /// </summary> /// <param name="userId">The user's id.</param> /// <returns></returns> public int Delete(string userId, string role) { string commandText = "DELETE FROM AspNetUserRoles WHERE UserId = @userId AND RoleId = @Role;"; Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("UserId", userId); parameters.Add("Role", role); return(_database.Execute(commandText, parameters)); }
/// <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 " + fullTableName + " set " + fieldPassword.Quoted() + " = @pwdHash where " + fieldID.Quoted() + " = @id"; Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("@pwdHash", passwordHash); parameters.Add("@id", userId); return(_database.Execute(commandText, parameters)); }
/// <summary> /// Deletes a login record 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 \"AspNetUserLogins\" 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)); }
/// <summary> /// Deletes a login record 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 " + fullTableName + " WHERE " + fielduserID.Quoted() + " = @userId AND " + fieldLoginProvider.Quoted() + " = @loginProvider " + " AND " + fieldProviderKey.Quoted() + " = @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)); }