public IQueryable <Entity.GalleryItem> GetGalleryItemsForAlbumId(int id, int sortByMetaNameId = int.MinValue, bool sortAscending = true) { // GET /api/albums/12/galleryitems?sortByMetaNameId=11&sortAscending=true - Gets gallery items for album #12 try { return(GalleryObjectController.GetGalleryItemsInAlbum(id, (MetadataItemName)sortByMetaNameId, sortAscending)); } catch (InvalidAlbumException) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent(String.Format("Could not find album with ID = {0}", id)), ReasonPhrase = "Album Not Found" }); } catch (GallerySecurityException) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden)); } catch (Exception ex) { AppEventController.LogError(ex); throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = Utils.GetExStringContent(ex), ReasonPhrase = "Server Error" }); } }
public async Task <IActionResult> GetGalleryItemsForAlbumId(int id, int sortByMetaNameId = int.MinValue, bool sortAscending = true) { // GET /api/albums/galleryitems/12?sortByMetaNameId=11&sortAscending=true - Gets gallery items for album #12 try { return(new JsonResult(await _galleryObjectController.GetGalleryItemsInAlbum(id, (MetadataItemName)sortByMetaNameId, sortAscending))); } catch (InvalidAlbumException) { return(NotFound($"Could not find album with ID {id}.")); } catch (GallerySecurityException ex) { AppEventController.LogError(ex); return(Forbid()); } catch (Exception ex) { AppEventController.LogError(ex); return(StatusCode(500, _exController.GetExString(ex))); } }