src/SyncTool.Git/main/Synchronization/SyncActions/GitSyncActionService.cs
/// <summary>
/// Checks that all the specified sync actions already exist and throws a <see cref="SyncActionNotFoundException"/> if the action can not be found
/// </summary>
/// <param name="syncActions">The action to check</param>
/// <param name="checkState">Specifies whether to also check if the existing action have the same state value as the specified actions</param>
Checks that all the specified sync actions already exist and throws a  if the action can not be found
Checks that all the specified sync actions already exist and throws a if the action can not be found
void AssertSyncActionsExist(IEnumerable<SyncAction> syncActions, bool checkState)
        {
            if (checkState)
            {
                foreach (var action in syncActions)
                {
                    var exisitingActions = this[action.State, action.Path].Where(a => a.Id == action.Id);
                    if (!exisitingActions.Any())
                    {
                        throw new SyncActionNotFoundException($"A sync action with id {action.Id} and state {action.State} was not found and cannot be updated");
                    }
                }
            }
            else
            {
                foreach (var action in syncActions)
                {
                    var exisitingActions = this[action.Path].Where(a => a.Id == action.Id);
                    if (!exisitingActions.Any())
                    {
                        throw new SyncActionNotFoundException($"A sync action with id {action.Id} was not found and cannot be updated");
                    }
                }
            }
        }
void AssertSyncActionsExist ( IEnumerable < SyncAction > syncActions , bool checkState ) { if ( checkState ) { foreach ( var action in syncActions ) { var exisitingActions = this [ action . State , action . Path ] . Where ( a => a . Id == action . Id ) ; if ( ! exisitingActions . Any ( ) ) { throw new SyncActionNotFoundException ( $" A sync action with id  { action . Id }  and state  { action . State }  was not found and cannot be updated " ) ; } } } else { foreach ( var action in syncActions ) { var exisitingActions = this [ action . Path ] . Where ( a => a . Id == action . Id ) ; if ( ! exisitingActions . Any ( ) ) { throw new SyncActionNotFoundException ( $" A sync action with id  { action . Id }  was not found and cannot be updated " ) ; } } } }
Checks that all the specified sync actions already exist and throws a  if the action can not be found
Checks that all the specified sync actions already exist and throws a if the action can not be found
syncActions
IEnumerable<SyncAction>
The action to check
The action to check
checkState
bool
Specifies whether to also check if the existing action have the same state value as the specified actions
Specifies whether to also check if the existing action have the same state value as the specified actions