我有两个控制器。
一个是
public partial class CatalogController : BaseNopController
{
[NonAction]
protected IEnumerable<ProductOverviewModel> PrepareProductOverviewModels(IEnumerable<Product> products,
bool preparePriceModel = true, bool preparePictureModel = true,
int? productThumbPictureSize = null, bool prepareSpecificationAttributes = false,
bool forceRedirectionAfterAddingToCart = false)
{
var models = new List<ProductOverviewModel>();
foreach (var product in products)
{
var model = new ProductOverviewModel()
{
Id = product.Id,
Name = product.GetLocalized(x => x.Name),
ShortDescription = product.GetLocalized(x => x.ShortDescription),
FullDescription = product.GetLocalized(x => x.FullDescription),
SeName = product.GetSeName(),
};
}
}
另一个是
public class HireController : BaseNopController
{
[HttpPost]
public ActionResult CheckData(string submitButton)
{
switch (submitButton)
{
case "Yes":
// I want to call CatalogController --> PrepareProductOverviewModels
case "No":
return RedirectToRoute("detailform");
default:
return RedirectToRoute("detailform");
}
}
}
在 Hire 控制器 --> CheckData 函数中,我想调用 CatalogController -->PrepareProductOverviewModels(...) 我该怎么做?