combine transaction revit api
using (TransactionGroup transGroup = new TransactionGroup(document))
{
using (Transaction trans = new Transaction(document))
{
try
{
transGroup.Start("Action");
trans.Start("First Transaction");
// do some stuff
if (trans.Commit() != TransactionStatus.Committed)
{
return Result.Failed;
}
trans.Start("Second Transaction");
// do some more stuff
trans.Commit();
if (trans.Commit() != TransactionStatus.Committed)
{
return Result.Failed;
}
transGroup.Assimilate();
}
catch
{
return Result.Failed;
}
}
return Result.Succeeded;
}