是否有可能将formcollection转换为已知的“模型”? [HttpPost]
public ActionResult Settings(FormCollection fc)
{
var model=(Student)fc; // Error: Can't convert type 'FormCollection' to 'Student'
}
注
我有一个实体叫'候选人'。这不是那么特别。它本身就很好:我可以从一个类型创建一个表单并坚持它。 class CandidateType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name
我收到以下错误An unhandled exception occurred while processing the request. InvalidOperationException: The 'Microsoft.AspNetCore.Mvc.ModelBinding.Binders.FormCollectionModelBinder' cannot bind to a model of