Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Remove unused method - page list
KrzysztofPajake5c9011da90f
diff --git a/src/Core/Grand.Domain/Data/PagedList.cs b/src/Core/Grand.Domain/Data/PagedList.csdeleted file mode 100644index 14117a1ae..000000000--- a/src/Core/Grand.Domain/Data/PagedList.cs+++ /dev/null@@ -1,43 +0,0 @@-using MongoDB.Driver;-using MongoDB.Driver.Linq;-using System;-using System.Collections.Generic;-using System.Linq;-using System.Threading.Tasks;--namespace Grand.Domain-{- public partial class PagedList<T> : List<T>, IPagedList<T>- {- private async Task InitializeAsync(IMongoQueryable<T> source, int pageIndex, int pageSize, int? totalCount = null)- {- if (source == null)- throw new ArgumentNullException(nameof(source));- if (pageSize <= 0)- pageSize = 1;-- TotalCount = totalCount ?? await source.CountAsync();- source = totalCount == null ? source.Skip(pageIndex * pageSize).Take(pageSize) : source;- AddRange(source);-- if (pageSize > 0)- {- TotalPages = TotalCount / pageSize;- if (TotalCount % pageSize > 0)- TotalPages++;- }-- PageSize = pageSize;- PageIndex = pageIndex;- }-- public static async Task<PagedList<T>> Create(IQueryable<T> source, int pageIndex, int pageSize, FindOptions findOptions = null)- {- var pagelist = new PagedList<T>();- await pagelist.InitializeAsync((IMongoQueryable<T>)source, pageIndex, pageSize);- return pagelist;- }--- }-}diff --git a/src/Core/Grand.Domain/PagedList.cs b/src/Core/Grand.Domain/PagedList.csindex b8745f0bb..c072d4049 100644--- a/src/Core/Grand.Domain/PagedList.cs+++ b/src/Core/Grand.Domain/PagedList.cs@@ -1,6 +1,8 @@-using System;+using Grand.Domain.Data;+using System;using System.Collections.Generic;using System.Linq;+using System.Threading.Tasks;namespace Grand.Domain{@@ -47,6 +49,34 @@ namespace Grand.Domain{Initialize(source, pageIndex, pageSize, totalCount);}+ private async Task InitializeAsync(IQueryable<T> source, int pageIndex, int pageSize, int? totalCount = null)+ {+ if (source == null)+ throw new ArgumentNullException(nameof(source));+ if (pageSize <= 0)+ pageSize = 1;++ TotalCount = totalCount ?? await source.CountAsync2();+ source = totalCount == null ? source.Skip(pageIndex * pageSize).Take(pageSize) : source;+ AddRange(source);++ if (pageSize > 0)+ {+ TotalPages = TotalCount / pageSize;+ if (TotalCount % pageSize > 0)+ TotalPages++;+ }++ PageSize = pageSize;+ PageIndex = pageIndex;+ }++ public static async Task<PagedList<T>> Create(IQueryable<T> source, int pageIndex, int pageSize)+ {+ var pagelist = new PagedList<T>();+ await pagelist.InitializeAsync(source, pageIndex, pageSize);+ return pagelist;+ }public int PageIndex { get; private set; }public int PageSize { get; private set; }