public async Task SaveKeyValueHistoryAsync(
            string keyValueId,
            string newValue,
            string keyValues,
            string userName,
            string userIpAddress)
        {
            var datetime = DateTime.UtcNow.StorageString();
            var th       = new KeyValueHistory
            {
                PartitionKey  = keyValueId,
                RowKey        = datetime,
                DateTime      = datetime,
                KeyValueId    = keyValueId,
                NewValue      = newValue,
                UserName      = userName,
                UserIpAddress = userIpAddress
            };

            th.KeyValuesSnapshot = $"{th.UserName}_{th.RowKey}_{th.UserIpAddress}";

            await _blobStorage.SaveBlobAsync(_container, th.KeyValuesSnapshot, Encoding.UTF8.GetBytes(keyValues));

            await _tableStorage.InsertOrMergeAsync(th);
        }
Exemple #2
0
        public async Task DeleteKeyValueHistoryAsync(string keyValueId, string description, string userName, string userIpAddress)
        {
            var th = new KeyValueHistory
            {
                KeyValueId    = keyValueId,
                PartitionKey  = keyValueId,
                RowKey        = DateTime.UtcNow.StorageString(),
                UserName      = userName,
                UserIpAddress = userIpAddress
            };

            th.KeyValuesSnapshot = $"{th.UserName}_{th.RowKey}_{th.UserIpAddress}";

            await _blobStorage.SaveBlobAsync(_container, th.KeyValuesSnapshot, Encoding.UTF8.GetBytes(description));

            await _tableStorage.InsertOrMergeAsync(th);
        }