public IActionResult SizeList(SearchPaginationListModel searchModel) { try { if (searchModel.pageNo <= 0) { searchModel.pageNo = 1; } var sizeList = iSize.GetSizeList(searchModel.searchString); if (sizeList != null) { List <SizeListModel> sizeResult = new List <SizeListModel>(); sizeResult = SizeHelper.BindSizeListModel(sizeList); var sizeIds = SizeHelper.GetSizeIds(sizeResult); var productList = iSize.GetTotalProductSizeCount(sizeIds); sizeResult = SizeHelper.BindSizeListModel(sizeResult, productList); #region Sorting var sizeResult1 = SortingHelper.GetSortedSizes(searchModel.column, searchModel.direction, sizeResult).ToPagedList(searchModel.pageNo, searchModel.limit).ToList(); #endregion PagedListModel <SizeListModel> pagedListModel = new PagedListModel <SizeListModel>(); pagedListModel.Items = sizeResult1.ToList(); pagedListModel.Total = sizeResult.Select(x => x.SizeId).Distinct().Count(); return(Ok(ResponseHelper.Success(pagedListModel))); } else { return(Ok(ResponseHelper.Error(MessageConstants.DataNotFound))); } } catch (Exception ex) { LogHelper.ExceptionLog(ex.Message + " ::::: " + ex.StackTrace); return(Ok(ResponseHelper.Error(ex.Message))); } }