Ejemplo n.º 1
0
        public async Task <PaginationResponse> GetDesigns([FromBody] PaginationRequest paginationRequest)
        {
            try
            {
                var sortOrder = paginationRequest.Order == null ? SortOrder.Descending : paginationRequest.Order.SortOrder;

                var recordCount = await _designService.GetDesignsCount(paginationRequest.Filter);

                var designs = await _designService.GetDesigns(paginationRequest.Filter, paginationRequest.Order?.OrderByProperty, sortOrder, paginationRequest.Page, paginationRequest.PageSize);

                return(new PaginationResponse
                {
                    Status = "Ok",
                    Data = designs,
                    RecordCount = recordCount
                });
            }
            catch (Exception ex)
            {
                _logger?.LogError(ex, "Error fetching designs.");
                return(new PaginationResponse {
                    Status = "Error", Message = "Error fetching designs."
                });
            }
        }