Esempio n. 1
0
        public async Task <IAssetCategory> AddAsync(IAssetCategory assetCategory)
        {
            await _assetCategoryRepository.AddAsync(assetCategory);

            await _myNoSqlWriter.TryInsertOrReplaceAsync(AssetCategoryNoSql.Create(assetCategory));

            return(assetCategory);
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 3
0
        public async Task UpdateAsync(IAssetCategory assetCategory)
        {
            await _assetCategoryRepository.UpdateAsync(assetCategory);

            await _myNoSqlWriter.TryInsertOrReplaceAsync(AssetCategoryNoSql.Create(assetCategory));
        }
Esempio n. 4
0
        public async Task RemoveAsync(string id)
        {
            await _assetCategoryRepository.RemoveAsync(id);

            await _myNoSqlWriter.TryDeleteAsync(AssetCategoryNoSql.GeneratePartitionKey(), AssetCategoryNoSql.GenerateRowKey(id));
        }