private void PersistWorkflow(Rock.Model.Workflow workflow ) { if (workflow.Id == 0) { var workflowService = new WorkflowService( _rockContext ); workflowService.Add( workflow ); } _rockContext.WrapTransaction( () => { _rockContext.SaveChanges(); workflow.SaveAttributeValues( _rockContext ); foreach (var activity in workflow.Activities) { activity.SaveAttributeValues( _rockContext ); } } ); }
private void SaveForProcessingLater(Rock.Model.Workflow newWorkflow, RockContext rockContext) { newWorkflow.IsPersisted = true; var service = new WorkflowService( rockContext ); if (newWorkflow.Id == 0) { service.Add( newWorkflow ); } rockContext.WrapTransaction( () => { rockContext.SaveChanges(); newWorkflow.SaveAttributeValues( rockContext ); foreach (var activity in newWorkflow.Activities) { activity.SaveAttributeValues( rockContext ); } } ); }