I am getting the error "The model item passed into the dictionary is of type 'Orchard.UI.Zones.ZoneHolding', but this dictionary requires a model item of type'First.Module.Models.PersonListPart'", when entering the editor page for the content in the admin dashboard.
My content driver looks like:
public class PersonListPartDriver : ContentPartDriver<PersonListPart>
{
protected override DriverResult Display(
PersonListPart part, string displayType, dynamic shapeHelper) {
return ContentShape("Parts_PersonList",
() => shapeHelper.Parts_PersonList(
MaxCount: part.MaxCount
));
}
protected override DriverResult Editor(
PersonListPart part, dynamic shapeHelper) {
return ContentShape("Parts_PersonList_Edit",
() => shapeHelper.EditorTemplate(
TemplateName: "Parts/PersonList",
Models: part,
Prefix: Prefix
));
}
//POST
protected override DriverResult Editor(
PersonListPart part, IUpdateModel updater, dynamic shapeHelper)
{
updater.TryUpdateModel(part, Prefix, null, null);
return Editor(part, shapeHelper);
}
}
My PersonListPart Model looks like:
namespace First.Module.Models {
public class PersonListPart : ContentPart<PersonListPartRecord> {
public int MaxCount {
get { return Record.MaxCount; }
set { Record.MaxCount = value; }
}
}
public class PersonListPartRecord : ContentPartRecord {
public virtual int MaxCount { get; set; }
}
}
It loads the Editor CSHTML for the content part which looks like:
@model First.Module.Models.PersonListPart
<fieldset>
<legend>@T("Person List Settings")</legend>
<ol>
<li>
@Html.LabelFor(m => m.MaxCount, T("Maximal count"));
@Html.TextBoxFor(m => m.MaxCount, new { @class = "text small" })
</li>
</ol>
</fieldset>
It is having an issue in particular with the @model.
When debugging and commenting out the @model, the Model.ContentItem.Part[0] has the item, but being new to Orchard CMS I am stumped how to use this correctly.