Код ViewComponent:
Код: Выделить всё
using Microsoft.AspNetCore.Mvc;
namespace UI.ViewComponents
{
public class AppViewComponent : ViewComponent
{
public AppViewComponent()
{
}
public IViewComponentResult Invoke(string baseFolder, string componentName, dynamic paramData)
{
return View($"/Views/{baseFolder}/Components/{componentName}.cshtml", paramData);
}
}
}
Код: Выделить всё
@await Component.InvokeAsync("App",
new
{
baseFolder = "Provider",
componentName = "Edit",
paramData = (Provider: Model.provider, TestData: Model.testData)
})
@await Component.InvokeAsync("App",
new
{
baseFolder = "Account",
componentName = "Edit",
paramData = (Account: Model.account)
})
Код: Выделить всё
@model (Provider provider, string[] testData)
Подробнее здесь: https://stackoverflow.com/questions/776 ... ents-in-as