コード例 #1
0
 public static Asset ToDomainModel(this SDK.Models.Asset entity, Asset destination = null)
 {
     if (entity != null)
     {
         if (destination == null)
         {
             destination = new Domain.Asset();
         }
         Asset result = am.Mapper.Map <SDK.Models.Asset, Asset>(entity, destination);
         return(result);
     }
     return(null);
 }
コード例 #2
0
 public void CreateAsset(AssetDTO assetDTO)
 {
     Domain.Asset asset = new Domain.Asset()
     {
         AssetKey        = assetDTO.AssetTag,
         ProductKey      = assetDTO.ProductKey,
         ManufacturerKey = assetDTO.ManufacturerKey,
         ModelKey        = assetDTO.ModelKey,
         LocationKey     = assetDTO.LocationKey,
         ClientSiteKey   = assetDTO.ClientSiteKey,
         SerialNumber    = assetDTO.SerialNumber,
         ItemName        = assetDTO.ItemName,
         InventoryDate   = assetDTO.InventoryDate,
         PurchaseDate    = assetDTO.PurchaseDate,
         InventoryOwner  = assetDTO.InventoryOwner,
         InventoriedBy   = assetDTO.InventoriedBy,
         IsDisposed      = assetDTO.isDisposed
     };
     db.Asset.Add(asset);
     db.SaveChanges();
 }