We have the following code snippet:
public static IList GetAssets(this IAssetContainer assetContainer, IContentLoader contentLoader, IUrlResolver urlResolver) where TContentMedia : IContentMedia {
var assets = new List();
if (assetContainer?.CommerceMediaCollection == null) { return assets; }
var assetQuery = assetContainer.CommerceMediaCollection.Select(media => media).Where(x => ValidateCorrectType(x.AssetLink, contentLoader));
foreach (var media in assetQuery) { if (contentLoader.TryGet(media.AssetLink, out TContentMedia asset)) { if (!asset.IsDeleted) {
var mediaGroupName = media.GroupName;
asset.Property["DownloadItemType"].Value = mediaGroupName ;
}
assets.Add(asset); }} }
return assets; }
code in code causing problem not able to set the read only property; please suggest the how to set the "DownloadItemType" property value.
We have the following code snippet:
public static IList GetAssets(this IAssetContainer assetContainer, IContentLoader contentLoader, IUrlResolver urlResolver)
where TContentMedia : IContentMedia
{
var assets = new List();
if (assetContainer?.CommerceMediaCollection == null)
{
return assets;
}
var assetQuery = assetContainer.CommerceMediaCollection.Select(media => media).Where(x => ValidateCorrectType(x.AssetLink, contentLoader));
foreach (var media in assetQuery)
{
if (contentLoader.TryGet(media.AssetLink, out TContentMedia asset))
{
if (!asset.IsDeleted)
{
var mediaGroupName = media.GroupName;
asset.Property["DownloadItemType"].Value = mediaGroupName ;
}
assets.Add(asset);
}
}
}
return assets;
}
code in code causing problem not able to set the read only property; please suggest the how to set the "DownloadItemType" property value.