Exemple #1
0
        public IAlbum GetByRating(string rating, int top = 50, int sortByMetaNameId = (int)MetadataItemName.DateAdded, bool sortAscending = false, string destinationUrl = null, string filter = "mediaobject", int galleryId = int.MinValue)
        {
            IAlbum album = null;

            try
            {
                album = GalleryObjectController.GetRatedMediaObjects(rating, top, ValidateGallery(galleryId), GalleryObjectTypeEnumHelper.Parse(filter, GalleryObjectType.MediaObject));

                album.FeedFormatterOptions = new FeedFormatterOptions()
                {
                    SortByMetaName = (MetadataItemName)sortByMetaNameId,
                    SortAscending  = sortAscending,
                    DestinationUrl = String.IsNullOrWhiteSpace(destinationUrl) ? String.Concat(Utils.AppRoot, "/") : destinationUrl
                };

                return(album);
            }
            catch (GallerySecurityException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (Exception ex)
            {
                AppEventController.LogError(ex, (album != null ? album.GalleryId : new int?()));

                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = Utils.GetExStringContent(ex),
                    ReasonPhrase = "Server Error"
                });
            }
        }