public IPublishedContent Media(Guid id) { //TODO: This is horrible but until the media cache properly supports GUIDs we have no choice here and // currently there won't be any way to add this method correctly to `ITypedPublishedContentQuery` without breaking an interface and adding GUID support for media var entityService = Current.Services.EntityService; // fixme inject var mediaAttempt = entityService.GetId(id, UmbracoObjectTypes.Media); return(mediaAttempt.Success ? ContentQuery.Media(mediaAttempt.Result) : null); }
private IEnumerable <IPublishedContent> MediaForObjects(IEnumerable <object> ids) { var idsA = ids.ToArray(); IEnumerable <int> intIds; if (ConvertIdsObjectToInts(idsA, out intIds)) { return(ContentQuery.Media(intIds)); } //IEnumerable<Guid> guidIds; //if (ConvertIdsObjectToGuids(idsA, out guidIds)) // return ContentQuery.Media(guidIds); return(Enumerable.Empty <IPublishedContent>()); }
private IPublishedContent MediaForObject(object id) { if (ConvertIdObjectToInt(id, out var intId)) { return(ContentQuery.Media(intId)); } if (ConvertIdObjectToGuid(id, out var guidId)) { return(ContentQuery.Media(guidId)); } if (ConvertIdObjectToUdi(id, out var udiId)) { return(ContentQuery.Media(udiId)); } return(null); }
/// <summary> /// Gets the medias corresponding to the identifiers. /// </summary> /// <param name="ids">The media identifiers.</param> /// <returns>The existing medias corresponding to the identifiers.</returns> /// <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public IEnumerable <IPublishedContent> Media(IEnumerable <int> ids) { return(ContentQuery.Media(ids)); }
/// <summary> /// Gets the medias corresponding to the identifiers. /// </summary> /// <param name="ids">The media identifiers.</param> /// <returns>The existing medias corresponding to the identifiers.</returns> /// <remarks>If an identifier does not match an existing media, it will be missing in the returned value.</remarks> public IEnumerable <IPublishedContent> Media(params int[] ids) { return(ContentQuery.Media(ids)); }
public IPublishedContent Media(int id) { return(ContentQuery.Media(id)); }