Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

SettingModeViewComponent.cs

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 setting mode
/// 
public partial class SettingModeViewComponent : NopViewComponent
{
    #region Fields

    protected readonly ISettingModelFactory _settingModelFactory;

    #endregion

    #region Ctor

    public SettingModeViewComponent(ISettingModelFactory settingModelFactory)
    {
        _settingModelFactory = settingModelFactory;
    }

    #endregion

    #region Methods

    /// 
    /// Invoke view component
    /// 
    /// Setting mode name
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the view component result
    /// 
    public async Task InvokeAsync(string modeName = "settings-advanced-mode")
    {
        //prepare model
        var model = await _settingModelFactory.PrepareSettingModeModelAsync(modeName);

        return View(model);
    }

    #endregion
}