private async Task ImportOperations(List <CardOperation> operations) { RenderOperationsInfo(operations); List <CardOperation> operationsToSaveToStorage = operations.ToList(); while (true) { if (!AskUserIfEditIsNeeded()) { operationsToSaveToStorage.ForEach(op => op.UserDefinedName = op.UserDefinedName ?? op.OriginalName); break; } for (var i = 0; i < operationsToSaveToStorage.Count;) { var operation = operationsToSaveToStorage[i]; var editOpearationCommand = new EditCardOperationUserInterfaceCommand(operation, _cardOperationView, _dbLogicManager); var editedOperations = await editOpearationCommand.ExecuteAsync(); operationsToSaveToStorage.RemoveAt(i); operationsToSaveToStorage.InsertRange(i, editedOperations); i += editedOperations.Count; } Console.WriteLine("Операции после редактирования:"); RenderOperationsInfo(operationsToSaveToStorage); } ; var import = SaveImportToStorage(); SaveOperationsToStorage(operationsToSaveToStorage, import); }
public async Task ExecuteAsync(List <CardOperation> operations) { var editedOperations = new List <CardOperation>(); foreach (var operation in operations) { var editOperationCommand = new EditCardOperationUserInterfaceCommand(operation, _cardOperationStringView, _dbLogicManager); var editedOperation = await editOperationCommand.ExecuteAsync(); editedOperations.AddRange(editedOperation); } await _dbLogicManager.CreateOrUpdateOperations(editedOperations); }