Example #1
0
        public async Task <ActionResult <Page <LibraryItem> > > GetAll(
            [FromQuery] string sortBy,
            [FromQuery] Dictionary <string, string> where,
            [FromQuery] int limit   = 50,
            [FromQuery] int?afterID = null)
        {
            try
            {
                ICollection <LibraryItem> resources = await _libraryItems.GetAll(
                    ApiHelper.ParseWhere <LibraryItem>(where),
                    new Sort <LibraryItem>(sortBy),
                    new Pagination(limit, afterID)
                    );

                return(Page(resources, limit));
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(new RequestError(ex.Message)));
            }
        }