public ActionResult MediaGallery() { var mediaFiles = mMediaFileRepository.GetMediaFiles(); var mediaGallery = new MediaGalleryViewModel(mMediaFileRepository.SiteName, mMediaFileRepository.MediaLibraryDisplayName); mediaGallery.MediaFiles = mediaFiles.Select(MediaFileViewModel.GetViewModel); return(PartialView("_MediaGallery", mediaGallery)); }
public IViewComponentResult Invoke() { var mediaLibary = mediaFileRepository.GetByName(MEDIA_LIBRARY_NAME); if (mediaLibary == null) { return(Content(string.Empty)); } var mediaFiles = mediaFileRepository.GetMediaFiles(MEDIA_LIBRARY_NAME); var mediaGallery = new MediaGalleryViewModel(mediaLibary.LibraryDisplayName); mediaGallery.MediaFiles = mediaFiles.Select(file => MediaFileViewModel.GetViewModel(file, fileUrlRetriever)); return(View("~/Components/ViewComponents/MediaGallery/Default.cshtml", mediaGallery)); }
public ActionResult MediaGallery() { var mediaLibary = mMediaFileRepository.GetByName(MEDIA_LIBRARY_NAME); if (mediaLibary == null) { throw new HttpException(404, "Media library not found."); } var mediaFiles = mMediaFileRepository.GetMediaFiles(MEDIA_LIBRARY_NAME); var mediaGallery = new MediaGalleryViewModel(mediaLibary.LibraryDisplayName); mediaGallery.MediaFiles = mediaFiles.Select(MediaFileViewModel.GetViewModel); return(PartialView("_MediaGallery", mediaGallery)); }