diff --git a/src/Umbraco.Core/Services/MediaService.cs b/src/Umbraco.Core/Services/MediaService.cs index 68b4253f77..f3a967c096 100644 --- a/src/Umbraco.Core/Services/MediaService.cs +++ b/src/Umbraco.Core/Services/MediaService.cs @@ -206,6 +206,19 @@ namespace Umbraco.Core.Services } } + /// + /// Gets an object by Id + /// + /// Ids of the Media to retrieve + /// + internal IEnumerable GetByIds(IEnumerable ids) + { + using (var repository = _repositoryFactory.CreateMediaRepository(_uowProvider.GetUnitOfWork())) + { + return repository.GetAll(ids.ToArray()); + } + } + /// /// Gets an object by its 'UniqueId' /// diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index 837091ed94..c5aa02b049 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -84,6 +84,18 @@ namespace Umbraco.Web.Editors return Mapper.Map(foundContent); } + /// + /// Return media for the specified ids + /// + /// + /// + public IEnumerable GetByIds([FromUri]int[] ids) + { + var foundMedia = ((MediaService)Services.MediaService).GetByIds(ids); + return foundMedia.Select(Mapper.Map); + } + + /// /// Returns the root media objects /// diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index e0c56a92c3..c4435b86f1 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -303,7 +303,6 @@ -