Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (27 sloc) 1.02 KB
using System.Linq;
using EPiServer;
using EPiServer.ContentApi.Core;
using EPiServer.Web;
using ImageVault.Client;
using ImageVault.Common.Data;
using ImageVault.EPiServer;
using PocHeadlessCms.Site.ContentDelivery.PropertyModels.Models;
namespace Toders.ContentApi.Site.ContentDelivery.PropertyModels
{
public class MoreInfoImageVaultMediaReferencePropertyModel : PropertyModel<MoreInfoMediaReference, PropertyMedia>
{
public MoreInfoImageVaultMediaReferencePropertyModel(PropertyMedia propertyMedia)
: base(propertyMedia)
{
var media = ClientFactory.GetSdkClient()
.Load<Media>(propertyMedia.MediaReference, new PropertyMediaSettings())
.FirstOrDefault();
string absoluteUrl = UriSupport.Combine(SiteDefinition.Current.SiteUrl.ToString(), media.Url);
this.Value = new MoreInfoMediaReference
{
MediaReference = propertyMedia.MediaReference,
Url = absoluteUrl
};
}
}
}