Esempio n. 1
0
 public static IAsset GetAssetById(int id)
 {
     using (AssetRepository repo = new AssetRepository())
     {
         return(repo.GetById(id));
     }
 }
Esempio n. 2
0
        public void ThenTheAssetIsInserted()
        {
            _expected.Id = _sut.Insert(_expected);
            var actual = _sut.GetById(_expected.Id.Value);

            Assert.IsNotNull(actual);
            Assert.AreEqual(_expected, actual);
        }
Esempio n. 3
0
        public async Task <Asset> GetAsset(Guid id)
        {
            var asset = await _repo.GetById(id);

            if (asset == null)
            {
                _logger.LogDebug($"Asset with ID {id} not found.");
                return(null);
            }

            return(asset);
        }
Esempio n. 4
0
        public void ThenTheAssetsAreUpdated()
        {
            _expected[0].Tag         = "CRD-X-00003";
            _expected[0].ModifiedBy  = "user3";
            _expected[1].Description = "Modified description";
            _expected[1].ModifiedBy  = "user3";

            _expected.ForEach(_sut.Update);

            foreach (var asset in _expected)
            {
                var actual = _sut.GetById(asset.Id.Value);
                Assert.AreEqual(asset, actual);
            }
        }
Esempio n. 5
0
        public async Task <Asset> GetAsset(string id)
        {
            Asset asset;

            try
            {
                asset = await AssetRepository.GetById(id);

                if (asset == null)
                {
                    asset = await BlockchainDataProvider.GetAsset(id);

                    await AssetRepository.Save(asset);
                }
            }
            catch (Exception ex)
            {
                await Log.WriteError(this.GetType().ToString(), "GetAsset", $"asset_id:{id}", ex, DateTime.Now);

                return(null);
            }

            return(asset);
        }