33using Grand . Business . Core . Interfaces . Common . Directory ;
44using Grand . Business . Core . Interfaces . Common . Localization ;
55using Grand . Business . Core . Interfaces . Common . Stores ;
6- using Grand . Domain . Common ;
7- using Grand . Domain . Customers ;
86using Grand . Domain . Directory ;
97using Grand . Domain . Tax ;
10- using Grand . Infrastructure ;
118using Grand . Infrastructure . Caching ;
129using Grand . Infrastructure . Plugins ;
1310using Grand . Web . Admin . Extensions ;
2017using Grand . Web . Common . DataSource ;
2118using Grand . Web . Common . Extensions ;
2219using Grand . Web . Common . Filters ;
20+ using Grand . Web . Common . Helpers ;
2321using Grand . Web . Common . Localization ;
2422using Microsoft . AspNetCore . Mvc ;
2523using Microsoft . AspNetCore . Mvc . Rendering ;
@@ -43,34 +41,14 @@ public class TaxController(
4341 ICountryService countryService ,
4442 IStoreService storeService ,
4543 IEnumTranslationService enumTranslationService ,
46- IContextAccessor contextAccessor ,
44+ IAdminStoreService adminStoreService ,
4745 IAdminDataScope < TaxCategory > scope )
4846 : BaseTaxCategoryController ( taxCategoryService , storeService , translationService , scope )
4947{
50- /// <summary>
51- /// Get active store scope (for multi-store configuration mode)
52- /// </summary>
53- /// <returns>Store ID; 0 if we are in a shared mode</returns>
54- private async Task < string > GetActiveStore ( )
55- {
56- var workContext = contextAccessor . WorkContext ;
57-
58- var stores = await storeService . GetAllStores ( ) ;
59- if ( stores . Count < 2 )
60- return stores . FirstOrDefault ( ) ? . Id ;
61-
62- var storeId =
63- workContext . CurrentCustomer . GetUserFieldFromEntity < string > ( SystemCustomerFieldNames
64- . AdminAreaStoreScopeConfiguration ) ;
65- //empty scope means "all stores" - settings are loaded from/saved to the global scope
66- if ( string . IsNullOrEmpty ( storeId ) )
67- {
68- return "" ;
69- }
70-
71- var store = await storeService . GetStoreById ( storeId ) ;
72- return store != null ? store . Id : "" ;
73- }
48+ // ARCH-001 GetActiveStore() consolidation: was a hand-duplicated private copy of the same logic
49+ // now in IAdminStoreService (also used by BaseAdminController and StoreScope) - BaseTaxCategoryController
50+ // can't carry it itself, it must stay host-agnostic (Admin/Store/Vendor all extend it).
51+ private Task < string > GetActiveStore ( ) => adminStoreService . GetActiveStore ( ) ;
7452
7553 #region Tax Providers
7654
0 commit comments