In my ASP.NET MVC 5.2 application running .NET Framework v4.5.2, my AdminController
has an InventoryQueryList
method that accepts the model:
[HandleError]
[HttpPost]
public ActionResult InventoryQueryList(CheckInventoryQueryModel model)
{
// ...
}
My view contains the model and calls the InventoryQueryList
method on POST
:
@model CCNRebuild.Models.CheckInventoryQueryModel
@{
ViewBag.Title = "InventoryQuery";
Layout = "~/Views/Shared/_ConsoleLayout.cshtml";
}
@using (Html.BeginForm("InventoryQueryList", "Admin", FormMethod.Post))
{
@Html.AntiForgeryToken();
<label>
Dealer:@Html.DropDownListFor(m => m.DealerID, Model.Dealerships)
</label>
...
<input type="submit" value="Submit" />
}
But, whenever I click the submit button, I get an error:
MissingMethodException: No parameterless constructor defined for this object.
Why is the view not passing my model parameter to the controller?
The controller has never had a parameterless constructor in the 3 months that I have been working here.
NOTE: I tried to only show relevant code, and I left out anything unnecessary. If there is anything missing that needs to be seen, please comment and I'll try to oblige.