public SummaryOrderByIndividualDiscountModel SearchSummaryOrderByIndividualDiscountModels( [FromUri] OrderAdminSearchCriteria searchCriteria, [FromUri] PaginationOptions paginationOptions) { var tbl = _orderReportService.SearchSummaryOrderByIndividualDiscount(_workContext.User, paginationOptions, searchCriteria); var dataRows = tbl.AsEnumerable().Skip((paginationOptions.PageIndex - 1) * paginationOptions.PageSize).Take(paginationOptions.PageSize); var model = dataRows.Select(Mapper.Map <DataRow, SummaryOrderByIndividualDiscountRowModel>).ToList(); int summaryTotalAmount = 0; decimal summaryTotalDiscountedPrice = 0; decimal summaryTotalPrice = 0; if (model.Count > 0) { summaryTotalAmount = Convert.ToInt32(tbl.Compute("Sum(Quantity)", "")); summaryTotalDiscountedPrice = Convert.ToDecimal(tbl.Compute("Sum(TotalDiscountedPrice)", "")); summaryTotalPrice = Convert.ToDecimal(tbl.Compute("Sum(TotalPrice)", "")); } return(new SummaryOrderByIndividualDiscountModel() { Data = model, SummaryTotalPrice = summaryTotalPrice, SummaryTotalAmount = summaryTotalAmount, SummaryTotalDiscountedPrice = summaryTotalDiscountedPrice, TotalItems = tbl.Rows.Count }); }