public async Task <IActionResult> Product([FromQuery] GetProductsDto item = null) { if (item == null) { item = new GetProductsDto(); } var result = await _repoSnack.GetAllSnacksPagination(new PaginationDTO { PageNumber = item.PageNumber, PageSize = item.PageSize, SortBy = item.SortBy.ToString(), Order = item.Order.ToString() }); return(Ok(result.Select(x => new GetProductsResponseDto { Id = x.snackId, Name = x.snackName, Price = x.snackPrice, Likes = x.snackLikes, Stock = x.snackQuantity }))); }