I'm trying to add a view returned from a controller into my view statically. In standard MVC I would do something like the below.
@{Html.RenderAction("Product", "ProductListing", new {productId = product.ItemId});}
Here is my controller
[System.Web.Http.HttpGet]
public ActionResult Product(ID productId)
{
var product= _productRepositorty.GetProduct(productId);
return View("~/Views/Product/ProductDetails.cshtml", product);
}
So using the Sitecore rendering helper i have the below, where the ID is the rendering item within Sitecore pointing at the controller and action as above. However I am unable to pass through the productId as a parameter into the Product action (the productId is always null). Is this the correct way of passing a variable to another action?
@Html.Sitecore().Rendering("{AA6C2188-1897-4577-BE0A-25DD2BBA8AF1}", new { productId = product.ItemId })