这是调用视图的控制器方法:
[HttpGet]
public ActionResult Edit(int? paramid)
{
var document = documentRepository.DocumentsWithEmpty.FirstOrDefault(c => c.ID == paramid.Value);
RC rc = new RC(document);
return View("RC", rc);
}
这是视图(目前很空)
@model RC
@{
Layout = null;
}
@using (Html.BeginForm()) //I've also tried by specifying the method/controller/param
{
//I've also tried with some @Html.EditorFor items
}
控制器中捕获发布的RC
[HttpPost]
public ActionResult Edit(RC rc) //If I put no parameter, it gets called correctly
{
throw new Exception("x");
}
它是唯一无法正常工作的实体/地方。可能是因为RC不是我数据库中的实体吗?
Firebug为GET和POST请求指出了这些请求(POST请求为红色)。很简单
http://localhost:58136/Documents/Edit/23?_=1351197746968