public async Task <IAssetCategory> AddAsync(IAssetCategory assetCategory) { await _assetCategoryRepository.AddAsync(assetCategory); await _myNoSqlWriter.TryInsertOrReplaceAsync(AssetCategoryNoSql.Create(assetCategory)); return(assetCategory); }
IAssetCategory IAssetCategoryClient.Get(string id) { try { var data = _readerAssetCategoryNoSql.Get( AssetCategoryNoSql.GeneratePartitionKey(), AssetCategoryNoSql.GenerateRowKey(id)); return(data?.Category); } catch (Exception ex) { Console.WriteLine($"Cannot read from MyNoSQL. Table: ${AssetCategoryNoSql.TableName}, PK: {AssetCategoryNoSql.GeneratePartitionKey()}, RK: {AssetCategoryNoSql.GenerateRowKey(id)}, Ex: {ex}"); throw; } }
public async Task UpdateAsync(IAssetCategory assetCategory) { await _assetCategoryRepository.UpdateAsync(assetCategory); await _myNoSqlWriter.TryInsertOrReplaceAsync(AssetCategoryNoSql.Create(assetCategory)); }
public async Task RemoveAsync(string id) { await _assetCategoryRepository.RemoveAsync(id); await _myNoSqlWriter.TryDeleteAsync(AssetCategoryNoSql.GeneratePartitionKey(), AssetCategoryNoSql.GenerateRowKey(id)); }