这不是重复的线程。 我的情况是发送没有模型的数组参数。但其他线程是发送int,字符串参数个体。是否有没有模型的数组后表单的方法?
我知道如何发布与模型对象控制器。
但有时我想模型db和岗位格式对象或数组 之外发布的数据我怎么能这样做?
查看
<form action="/home/showdata" method="post">
<input type="text" name="arr.username" />
<input type="text" name="arr.password" />
<input type="text" name="arr.email" />
</form>
控制器
public class HomeController : Controller
{
[HttpPost]
public ActionResult ShowData(Array data)
{
return Content(data.username + data.password + data.email);
}
}
为什么你要做到这一点没有一个模式? – DavidG
,因为有些字段不在数据库表中。 –
数据库与这里发布的模型有什么关系? – DavidG