30 lines
1001 B
C#
30 lines
1001 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using Nop.Core.Domain.Catalog;
|
|
using Nop.Web.Factories;
|
|
using Nop.Web.Framework.Components;
|
|
|
|
namespace Nop.Web.Components;
|
|
|
|
public partial class ManufacturerNavigationViewComponent : NopViewComponent
|
|
{
|
|
protected readonly CatalogSettings _catalogSettings;
|
|
protected readonly ICatalogModelFactory _catalogModelFactory;
|
|
|
|
public ManufacturerNavigationViewComponent(CatalogSettings catalogSettings, ICatalogModelFactory catalogModelFactory)
|
|
{
|
|
_catalogSettings = catalogSettings;
|
|
_catalogModelFactory = catalogModelFactory;
|
|
}
|
|
|
|
public async Task<IViewComponentResult> InvokeAsync(int currentManufacturerId)
|
|
{
|
|
if (_catalogSettings.ManufacturersBlockItemsToDisplay == 0)
|
|
return Content("");
|
|
|
|
var model = await _catalogModelFactory.PrepareManufacturerNavigationModelAsync(currentManufacturerId);
|
|
if (!model.Manufacturers.Any())
|
|
return Content("");
|
|
|
|
return View(model);
|
|
}
|
|
} |