前台异步传递
$.ajax({
type: "POST",
url: "/SystemOrder/InventoryRecord/SubmitForm",
data: JSON.stringify(vm.InventoryRecordInfo.List),
dataType: "json",
success: function (data) {
vm.$Notice.success({
title: '成功',
desc: '提交成功'
});
window.setTimeout(function () {
$.modalClose();
}, 1500);
}
});
后台接收
public ActionResult SubmitForm()
{
string result = "";
try
{
var sr = new StreamReader(Request.InputStream);
var stream = sr.ReadToEnd();
JavaScriptSerializer js = new JavaScriptSerializer();
List<SysInventoryRecordEntity> list = js.Deserialize<List<SysInventoryRecordEntity>>(stream);
sysInventoryRecordApp.SubmitForm(list);
result = new AjaxResult { state = ResultType.success.ToString(), message = "操作成功。" }.ToJson();
}
catch (Exception)
{
result = new AjaxResult { state = ResultType.error.ToString(), message = "操作失败。" }.ToJson();
throw;
}
return Content(result);
}
网友评论