///// <summary> ///// Determines whether the current user can view the specified <paramref name="album" />. ///// </summary> ///// <param name="album">The album.</param> ///// <returns><c>true</c> if the user can view the album; otherwise, <c>false</c>.</returns> //private bool CanUserViewAlbum(IAlbum album) //{ // return SecurityManager.IsUserAuthorized(SecurityActions.ViewAlbumOrMediaObject, SearchOptions.Roles, album.Id, SearchOptions.GalleryId, SearchOptions.IsUserAuthenticated, album.IsPrivate, SecurityActionsOption.RequireOne, album.IsVirtualAlbum); //} /// <summary> /// Gets a list of all tags in the gallery, regardless of a user's permission. /// </summary> /// <returns>IEnumerable{TagDto}.</returns> private IEnumerable <string> GetTags() { using (var repo = new MetadataTagRepository()) { return(repo.Where(t => t.FKGalleryId == SearchOptions.GalleryId && t.Metadata.MetaName == TagName) .Select(t => t.Tag.TagName).Distinct()); } }
/// <summary> /// Gets a list of all tags in the gallery, regardless of a user's permission. /// </summary> /// <returns>IEnumerable{TagDto}.</returns> private IEnumerable <Entity.Tag> GetTags() { using (var repo = new MetadataTagRepository()) { var tags = repo.Where(t => t.FKGalleryId == SearchOptions.GalleryId && t.Metadata.MetaName == TagName) .GroupBy(t => t.FKTagName) .Select(t => new Entity.Tag { Value = t.Key, Count = t.Count() }); return(SortAndFilter(tags)); } }
/// <summary> /// Gets a list of tags from database for the gallery, sorted on the specified property. /// </summary> /// <returns><see cref="List{T}" /> where T is <see cref="Entity.TagCacheItem" />.</returns> private List <Entity.TagCacheItem> GetAllSortedTagsFromDb() { using (var repo = new MetadataTagRepository()) { var query = repo.Where(t => t.FKGalleryId == SearchOptions.GalleryId && t.Metadata.MetaName == TagName) .GroupBy(t => t.FKTagName) .Select(t => new Entity.TagCacheItem { Value = t.Key, CountAll = t.Count(), CountPrivate = t.Count(mt => mt.Metadata.MediaObject.Album.IsPrivate || mt.Metadata.Album.IsPrivate) }); return(Sort(query).ToList()); } }
/// <summary> /// Gets a list of all tags in the gallery, regardless of a user's permission. /// </summary> /// <returns>IEnumerable{TagDto}.</returns> private IEnumerable<Entity.Tag> GetTags() { using (var repo = new MetadataTagRepository()) { var tags = repo.Where(t => t.FKGalleryId == SearchOptions.GalleryId && t.Metadata.MetaName == TagName) .GroupBy(t => t.FKTagName) .Select(t => new Entity.Tag { Value = t.Key, Count = t.Count() }); return SortAndFilter(tags); } }