Adding FirstMediaUrl to MediaLibraryPickerField

This commit is contained in:
Sebastien Ros
2014-08-06 10:27:32 -07:00
parent 6440cf9f5e
commit 25e334e66b

View File

@@ -21,6 +21,19 @@ namespace Orchard.MediaLibrary.Fields {
}
}
/// <summary>
/// Gets the MediaUrl property of the first Media, or null if none
/// </summary>
public string FirstMediaUrl {
get {
if (!MediaParts.Any()) {
return null;
}
return MediaParts.First().MediaUrl;
}
}
private string EncodeIds(ICollection<int> ids) {
if (ids == null || !ids.Any()) {
return string.Empty;