Ejemplo n.º 1
0
        public IAlbum GetByPeople(string q, int sortByMetaNameId = int.MinValue, bool sortAscending = true, string destinationUrl = null, string filter = "all", int galleryId = int.MinValue)
        {
            IAlbum album = null;

            try
            {
                album = GalleryObjectController.GetGalleryObjectsHavingTags(null, Utils.ToArray(q), GalleryObjectTypeEnumHelper.Parse(filter, GalleryObjectType.All), ValidateGallery(galleryId));

                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"
                });
            }
        }