Try your search with a different keyword or use * as a wildcard.
using Microsoft.AspNetCore.Mvc;
using Nop.Web.Framework.Factories;
using Nop.Web.Framework.Components;
namespace Nop.Web.Areas.Admin.Components;
///
/// Represents a view component that displays an admin widgets
///
public partial class AdminWidgetViewComponent : NopViewComponent
{
#region Fields
protected readonly IWidgetModelFactory _widgetModelFactory;
#endregion
#region Ctor
public AdminWidgetViewComponent(IWidgetModelFactory widgetModelFactory)
{
_widgetModelFactory = widgetModelFactory;
}
#endregion
#region Methods
///
/// Invoke view component
///
/// Widget zone name
/// Additional data
///
/// A task that represents the asynchronous operation
/// The task result contains the view component result
///
public async Task InvokeAsync(string widgetZone, object additionalData = null)
{
//prepare model
var models = await _widgetModelFactory.PrepareRenderWidgetModelAsync(widgetZone, additionalData, false);
//no data?
if (!models.Any())
return Content(string.Empty);
return View(models);
}
#endregion
}