private async Task <bool> UploadOtherAssets(Person person, SSG_SearchRequest request, SSG_Person ssg_person, int?providerDynamicsID, CancellationToken concellationToken) { if (person.OtherAssets == null) { return(true); } try { foreach (OtherAsset asset in person.OtherAssets) { AssetOtherEntity other = _mapper.Map <AssetOtherEntity>(asset); other.SearchRequest = request; other.InformationSource = providerDynamicsID; other.Person = ssg_person; SSG_Asset_Other ssgOtherAsset = await _searchRequestService.CreateOtherAsset(other, concellationToken); if (asset.Owners != null) { foreach (var owner in asset.Owners) { SSG_AssetOwner assetOwner = _mapper.Map <SSG_AssetOwner>(owner); assetOwner.OtherAsset = ssgOtherAsset; await _searchRequestService.CreateAssetOwner(assetOwner, concellationToken); } } } return(true); } catch (Exception ex) { _logger.LogError(ex.Message); return(false); } }
private async Task <bool> UploadOtherAssets() { if (_foundPerson.OtherAssets == null) { return(true); } try { _logger.LogDebug($"Attempting to create other assets records for SearchRequest[{_searchRequest.SearchRequestId}]"); foreach (OtherAsset asset in _foundPerson.OtherAssets) { AssetOtherEntity other = _mapper.Map <AssetOtherEntity>(asset); other.SearchRequest = _searchRequest; other.InformationSource = _providerDynamicsID; other.Person = _returnedPerson; SSG_Asset_Other ssgOtherAsset = await _searchRequestService.CreateOtherAsset(other, _cancellationToken); if (asset.Owners != null) { foreach (var owner in asset.Owners) { AssetOwnerEntity assetOwner = _mapper.Map <AssetOwnerEntity>(owner); assetOwner.OtherAsset = ssgOtherAsset; await _searchRequestService.CreateAssetOwner(assetOwner, _cancellationToken); } } await CreateResultTransaction(ssgOtherAsset); } return(true); } catch (Exception ex) { LogException(ex); return(false); } }