public async Task <TableStorageResponse <UserSetting> > SetUserSettingValueAsync(UserSetting setting) { var incomingEntity = new UserSettingTableEntity() { PartitionKey = _settingsTablePartitionKey, RowKey = setting.Key, SettingValue = setting.Value }; if (!string.IsNullOrWhiteSpace(setting.Etag)) { incomingEntity.ETag = setting.Etag; } TableStorageResponse <UserSetting> result = await AzureTableStorageHelper.DoTableInsertOrReplaceAsync <UserSetting, UserSettingTableEntity>(incomingEntity, (tableEntity) => { if (tableEntity == null) { return(null); } var updatedSetting = new UserSetting() { Key = tableEntity.RowKey, Value = tableEntity.SettingValue, Etag = tableEntity.ETag }; return(updatedSetting); }, _storageAccountConnectionString, _settingsTableName); return(result); }
private async Task <UserSetting> SetUserSettingImplAsync(string userId, UserSetting setting) { var incomingEntity = new UserSettingTableEntity(userId, setting); if (!string.IsNullOrWhiteSpace(setting.Etag)) { incomingEntity.ETag = setting.Etag; } TableStorageResponse <UserSetting> result = await _azureTableStorageClient.DoTableInsertOrReplaceAsync <UserSetting, UserSettingTableEntity>(incomingEntity, (tableEntity) => { if (tableEntity == null) { return(null); } return(new UserSetting(tableEntity)); }); return(result.Entity); }