public static coreModel.Asset ToCoreModel(this webModel.Asset asset) { var retVal = new coreModel.Asset(); retVal.InjectFrom(asset); retVal.Url = asset.RelativeUrl; return(retVal); }
public static webModel.Asset ToWebModel(this coreModel.Asset asset, IBlobUrlResolver blobUrlResolver) { var retVal = new webModel.Asset(); retVal.InjectFrom(asset); if (asset.Name == null) { retVal.Name = HttpUtility.UrlDecode(System.IO.Path.GetFileName(asset.Url)); } if (asset.MimeType == null) { retVal.MimeType = MimeTypeResolver.ResolveContentType(asset.Name); } if (blobUrlResolver != null) { retVal.Url = blobUrlResolver.GetAbsoluteUrl(asset.Url); } retVal.RelativeUrl = asset.Url; return retVal; }
public static webModel.Asset ToWebModel(this coreModel.Asset asset, IBlobUrlResolver blobUrlResolver) { var retVal = new webModel.Asset(); retVal.InjectFrom(asset); if (asset.Name == null) { retVal.Name = HttpUtility.UrlDecode(System.IO.Path.GetFileName(asset.Url)); } if (asset.MimeType == null) { retVal.MimeType = MimeTypeResolver.ResolveContentType(asset.Name); } if (blobUrlResolver != null) { retVal.Url = blobUrlResolver.GetAbsoluteUrl(asset.Url); } retVal.RelativeUrl = asset.Url; return(retVal); }