Пример #1
0
        public async Task InsertOrUpdateAllValues(InsertOrUpdateAllValuesInput input)
        {
            if (input.Items.IsNullOrEmpty())
            {
                return;
            }

            foreach (var item in input.Items)
            {
                await _entityDynamicParameterValueManager.CleanValuesAsync(item.EntityDynamicParameterId, item.EntityId);

                foreach (var newValue in item.Values)
                {
                    await _entityDynamicParameterValueManager.AddAsync(new EntityDynamicParameterValue
                    {
                        EntityDynamicParameterId = item.EntityDynamicParameterId,
                        EntityId = item.EntityId,
                        Value    = newValue,
                        TenantId = AbpSession.TenantId
                    });
                }
            }
        }
        public async Task Should_Clean_Values_Async()
        {
            var testItems = AddTestItems();

            await RunAndCheckIfPermissionControlledAsync(async() =>
            {
                await _entityDynamicParameterValueManager.CleanValuesAsync(testItems.entityDynamicParameter.Id, "123");
            });

            WithUnitOfWork(() =>
            {
                var items = _entityDynamicParameterValueManager.GetValues(testItems.entityDynamicParameter.Id, "123");
                items.ShouldBeEmpty();
            });
        }