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
Update query GetCustomerCount in CustomerTagService
support6a7620efca31
diff --git a/src/Business/Grand.Business.Marketing/Services/Customers/CustomerTagService.cs b/src/Business/Grand.Business.Marketing/Services/Customers/CustomerTagService.csindex d79daccea..178fee366 100644--- a/src/Business/Grand.Business.Marketing/Services/Customers/CustomerTagService.cs+++ b/src/Business/Grand.Business.Marketing/Services/Customers/CustomerTagService.cs@@ -175,11 +175,10 @@ namespace Grand.Business.Marketing.Services.Customers/// <returns>Number of customers</returns>public virtual async Task<int> GetCustomerCount(string customerTagId){- var query = _customerRepository.Table.- Where(x => x.CustomerTags.Contains(customerTagId)).- GroupBy(p => p, (k, s) => new { Counter = s.Count() }).ToList();- if (query.Count > 0)- return query.FirstOrDefault().Counter;+ var count = _customerRepository.Table.+ Count(x => x.CustomerTags.Contains(customerTagId));+ if (count > 0)+ return count;return await Task.FromResult(0);}