Ejemplo n.º 1
0
        /// <summary>
        /// Add asset details
        /// </summary>
        /// <param name="asset">Asset</param>
        /// <returns>Count of saved assets</returns>
        public Task <int> AddAsset(Domain.Asset asset)
        {
            _context.Assets.Add(new Asset()
            {
                AssetId     = asset.AssetId,
                AssetName   = asset.AssetName,
                AssetPath   = asset.AssetPath,
                AssetTypeId = (int)asset.AssetType,
                MainAssetId = asset.MainAssetId,
                Metadata    = asset.Metadata
            });

            return(_context.SaveChangesAsync());
        }
Ejemplo n.º 2
0
        internal static Domain.Asset ToDomainModel(this Asset assetModel)
        {
            if (assetModel == null)
            {
                return(null);
            }

            Domain.Asset asset = new Domain.Asset()
            {
                AssetId     = assetModel.AssetId,
                AssetName   = assetModel.AssetName,
                AssetType   = (Domain.AssetType)assetModel.AssetTypeId,
                AssetPath   = assetModel.AssetPath,
                MainAssetId = assetModel.MainAssetId,
                Metadata    = assetModel.Metadata
            };

            return(asset);
        }