0
在我的MVC应用程序,我已经定义了一个视图模型,如:形式系列化问题
public class Test
{
public Test(Models.Test1 t1)
{
//set the properties for t1
}
public Test(Models.Test1 t1, Models.Test1 t2)
:this(t1)
{
//set properties for t2
}
}
// properties for t1 and t2
}
TestModel在我看来是用来显示来自T1结合领域:如
public class TestModel : Test
{
public TestModel (Models.Test1 t1)
:base(t1)
{ }
public TestModel (Models.Test1 t1, Models.Test1 t2)
:base(t1,t2)
{ }
类检验定义和t2。当我提出这样的形式:
$('form').submit(function (evt) {
Save($(this).serialize(),
function() {
$('.loading').show();
},
function() {
alert('success');
});
});
$('a.save').click(function (evt) {
$(this).parents('form').submit();
});
- the controller action below is never hit.
[HttpPost]
public JsonResult Save(TestModel camp)
{
Helper.Save(camp);
return Json(JsonEnvelope.Success());
}
我认为序列化是行不通的,因为从TestModel派生测试。任何关于如何使这项工作的建议?