using Microsoft.AspNetCore.Mvc; using Nop.Web.Areas.Admin.Factories; using Nop.Web.Framework.Components; namespace Nop.Web.Areas.Admin.Components; /// /// Represents a view component that displays the store scope configuration /// public partial class StoreScopeConfigurationViewComponent : NopViewComponent { #region Fields protected readonly ISettingModelFactory _settingModelFactory; #endregion #region Ctor public StoreScopeConfigurationViewComponent(ISettingModelFactory settingModelFactory) { _settingModelFactory = settingModelFactory; } #endregion #region Methods /// /// Invoke view component /// /// /// A task that represents the asynchronous operation /// The task result contains the view component result /// public async Task InvokeAsync() { //prepare model var model = await _settingModelFactory.PrepareStoreScopeConfigurationModelAsync(); if (model.Stores.Count < 2) return Content(string.Empty); return View(model); } #endregion }