/// <summary> /// Patch changes /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void Patch(this dataModel.ItemAsset source, dataModel.ItemAsset target) { if (target == null) { throw new ArgumentNullException("target"); } var patchInjectionPolicy = new PatchInjection <dataModel.ItemAsset>(x => x.AssetType, x => x.SortOrder); target.InjectFrom(patchInjectionPolicy, source); }
/// <summary> /// Converting to foundation type /// </summary> /// <param name="itemAsset">The item asset.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">itemAsset</exception> public static dataModel.ItemAsset ToDataModel(this coreModel.ItemAsset itemAsset) { if (itemAsset == null) throw new ArgumentNullException("itemAsset"); var retVal = new dataModel.ItemAsset(); var id = retVal.Id; retVal.InjectFrom(itemAsset); if(itemAsset.Id == null) { retVal.Id = id; } retVal.AssetId = itemAsset.Url; retVal.GroupName = itemAsset.Group; retVal.AssetType = itemAsset.Type.ToString().ToLower(); return retVal; }
/// <summary> /// Converting to foundation type /// </summary> /// <param name="itemAsset">The item asset.</param> /// <returns></returns> /// <exception cref="System.ArgumentNullException">itemAsset</exception> public static dataModel.ItemAsset ToDataModel(this coreModel.ItemAsset itemAsset) { if (itemAsset == null) { throw new ArgumentNullException("itemAsset"); } var retVal = new dataModel.ItemAsset(); var id = retVal.Id; retVal.InjectFrom(itemAsset); if (itemAsset.Id == null) { retVal.Id = id; } retVal.AssetId = itemAsset.Url; retVal.GroupName = itemAsset.Group; retVal.AssetType = itemAsset.Type.ToString().ToLower(); return(retVal); }