Webiant Logo Webiant Logo
  1. No results found.

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

AdminLanguageSelectorViewComponent.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 admin language selector
/// 
public partial class AdminLanguageSelectorViewComponent : NopViewComponent
{
    #region Fields

    protected readonly ICommonModelFactory _commonModelFactory;

    #endregion

    #region Ctor

    public AdminLanguageSelectorViewComponent(ICommonModelFactory commonModelFactory)
    {
        _commonModelFactory = commonModelFactory;
    }

    #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 _commonModelFactory.PrepareLanguageSelectorModelAsync();

        return View(model);
    }

    #endregion
}