예제 #1
0
 /// <summary>
 /// Saves the changes.
 /// </summary>
 /// <param name="rockContext">The rock context.</param>
 /// <param name="modelType">Type of the model.</param>
 /// <param name="categoryGuid">The category unique identifier.</param>
 /// <param name="entityId">The entity identifier.</param>
 /// <param name="changes">The changes.</param>
 /// <param name="caption">The caption.</param>
 /// <param name="relatedModelType">Type of the related model.</param>
 /// <param name="relatedEntityId">The related entity identifier.</param>
 /// <param name="commitSave">if set to <c>true</c> [commit save].</param>
 /// <param name="modifiedByPersonAliasId">The modified by person alias identifier.</param>
 /// <param name="sourceOfChange">The source of change to be recorded on the history record. If this is not provided the RockContext source of change will be used instead.</param>
 public static void SaveChanges(RockContext rockContext, Type modelType, Guid categoryGuid, int entityId, History.HistoryChangeList changes, string caption, Type relatedModelType, int?relatedEntityId, bool commitSave = true, int?modifiedByPersonAliasId = null, string sourceOfChange = null)
 {
     if (changes.Any())
     {
         changes.ForEach(a => a.SourceOfChange = sourceOfChange ?? rockContext.SourceOfChange);
         AddChanges(rockContext, modelType, categoryGuid, entityId, changes, caption, relatedModelType, relatedEntityId, modifiedByPersonAliasId);
         if (commitSave)
         {
             rockContext.SaveChanges();
         }
     }
 }