I am trying to extend ProDinner by adding phone numbers to Chef.
ChefInput view model:
public class ChefInput :Input { public string Name { get; set; } public ChefInput() { PhoneNumberInputs = new List<PhoneNumberInput>(){ new PhoneNumberInput() };} public IList<PhoneNumberInput> PhoneNumberInputs { get; set; } }
PhoneInput view model:
public class PhoneNumberInput :Input { public string Number { get; set; } public PhoneType PhoneType { get; set; } <-- an enum in Core project }
Chef Create.cshtml file:
@using (Html.BeginForm()) { @Html.TextBoxFor(o => o.Name) @Html.EditorFor(o => o.PhoneNumberInputs) }
PhoneNumberInput.cshtml in EditorTemplate folder:
@using (Html.BeginCollectionItem("PhoneNumberInputs")) { @Html.DropDownListFor(m => m, new SelectList(Enum.GetNames(typeof(PreDefPhoneType)))) @Html.TextBoxFor(m => m.Number) }
When debugging and I stop it at Create in Crudere file, the Phone collection is null.
Anyone have any ideas? Thanks in Advance.