Пример #1
0
        public async Task DeleteKeyValueWithHistoryAsync(string keyValueId, string description, string userName, string userIpAddress)
        {
            var kvItem = await _tableStorage.GetDataAsync(KeyValueEntity.GeneratePartitionKey(), keyValueId);

            if (kvItem != null)
            {
                await _tableStorage.DeleteAsync(kvItem);

                await _history.DeleteKeyValueHistoryAsync(keyValueId, description, userName, userIpAddress);
            }
        }
Пример #2
0
        public async Task <bool> UpdateKeyValueAsync(IEnumerable <IKeyValueEntity> keyValueList)
        {
            try
            {
                foreach (var tableEntity in keyValueList)
                {
                    var te = (KeyValueEntity)tableEntity;
                    if (te.PartitionKey == null)
                    {
                        te.PartitionKey = KeyValueEntity.GeneratePartitionKey();
                    }
                    await _tableStorage.InsertOrMergeAsync(te);
                }
            }
            catch
            {
                return(false);
            }

            return(true);
        }
Пример #3
0
        public async Task <IEnumerable <IKeyValueEntity> > GetKeyValueAsync()
        {
            var pk = KeyValueEntity.GeneratePartitionKey();

            return(await _tableStorage.GetDataAsync(pk));
        }