示例#1
0
        /// <summary>
        /// Persists the current user's sort preference for the specified <paramref name="album" />. No action is taken if the
        /// album is virtual. Anonymous user data is stored in session only; logged on users' data are permanently stored.
        /// </summary>
        /// <param name="album">The album whose sort preference is to be preserved.</param>
        /// <param name="sortByMetaName">Name of the metadata item to sort by.</param>
        /// <param name="sortAscending">Indicates the sort direction.</param>
        private static void PersistUserSortPreference(IAlbum album, MetadataItemName sortByMetaName, bool sortAscending)
        {
            if (album.IsVirtualAlbum)
            {
                return;
            }

            var profile = ProfileController.GetProfile();

            var aProfile = profile.AlbumProfiles.Find(album.Id);

            if (aProfile == null)
            {
                profile.AlbumProfiles.Add(new AlbumProfile(album.Id, sortByMetaName, sortAscending));
            }
            else
            {
                aProfile.SortByMetaName = sortByMetaName;
                aProfile.SortAscending  = sortAscending;
            }

            ProfileController.SaveProfile(profile);
        }
示例#2
0
        public static void DeleteGallery(Business.Gallery gallery)
        {
            gallery.Delete();

            ProfileController.DeleteProfileForGallery(gallery);
        }