Jacob
12/19/2024, 10:09 AMpublic class ProductTypeModel : Productpage
{
public ProductTypeModel(IPublishedContent content, IPublishedValueFallback publishedValueFallback) : base(content, publishedValueFallback)
{
}
//Custom properties
public string ProductType
}
And Controller action:
public IActionResult Product(string producttype, string product, ProductType page)
{
if (CurrentPage is not IPublishedContent currentPage)
{
return NotFound();
}
var model = new ProductTypeModel(currentPage, _publishedValueFallback)
{
ProductType = producttype?.ToLower() ?? string.Empty,
Product = product?.ToLower() ?? string.Empty,
Page = page,
ProductUrl = HttpContext.Request.Path
};
var preparedModel = mProductControllerService.PrepareProductModel(model);
if (preparedModel.Success)
{
return View("~/Views/Product/Productpage.cshtml", preparedModel.Value);
}
return NotFound();
}
Thanks in advance!Jacob
12/19/2024, 10:31 AMpublic IPublishedContent? Content { get; set; }
And dont send the content from the controller i get the modelbinding error:
ModelBindingException: Cannot bind source type WebApp.Models.ProductTypeModel to model type Umbraco.Cms.Core.Models.PublishedContent.IPublishedContent.
Maybe that clarifies something 🙂