예제 #1
0
        public IHttpActionResult GetEducationsForPage(int pageNumber = 1, int itemsPerPage = 10, string sortField = "Id", string sortOrder = "DESC")
        {
            try
            {
                if (!(sortOrder == SortingService.SortByAscending || sortOrder == SortingService.SortByDescending))
                {
                    return(BadRequest("Invalid sort order"));
                }

                return(Ok(_educationService.GetEducationsForPage(pageNumber, itemsPerPage, sortField, sortOrder)));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }