Merge pull request #11743 from Shadowghost/fix-replace

Fix replace logic
This commit is contained in:
Joshua M. Boniface
2024-06-01 18:33:31 -04:00
committed by GitHub
16 changed files with 181 additions and 159 deletions

View File

@@ -5221,19 +5221,20 @@ AND Type = @InternalPersonType)");
throw new ArgumentNullException(nameof(itemId));
}
ArgumentNullException.ThrowIfNull(people);
CheckDisposed();
using var connection = GetConnection();
using var transaction = connection.BeginTransaction();
// First delete chapters
// Delete all existing people first
using var command = connection.CreateCommand();
command.CommandText = "delete from People where ItemId=@ItemId";
command.TryBind("@ItemId", itemId);
command.ExecuteNonQuery();
InsertPeople(itemId, people, connection);
if (people is not null)
{
InsertPeople(itemId, people, connection);
}
transaction.Commit();
}