页面代码:
//保存测量新增
$("#doAdd").click(function () {
var rowIndex = tabMeasuring.getSelectedRowIndex();
var NursingRecordID = tabMeasuring.getColumnValue(rowIndex, "NursingRecordID");
var MeasuringTime = $("#TJAMeasuringTimeS").val();
var AnimalHeat = $("#TJAAnimalHeatS").val();
var Pulse = $("#TJAPulseS").val();
var Breathe = $("#TJABreatheS").val();
var BloodPressure = $("#TJABloodPressureS").val();
$.getJSON("IncreasedMeasuring?NursingRecordID=" + NursingRecordID + "&MeasuringTime=" + MeasuringTime + "&AnimalHeat=" + AnimalHeat + "&Pulse=" + Pulse + "&Breathe=" + Breathe + "&BloodPressure=" + BloodPressure, function (msg) {
if (msg == "success") {
layer.msg("新增成功,正在返回!", { icon: 1, title: '提示' });
tabMeasuring.search({ NursingRecordID: NursingRecordID });
$("#myModaTwo").modal("hide");
$("#myModa").modal("show");
} else {
if (msg = "failed") {
layer.msg("新增失败!", { icon: 0, title: '提示' });
}
}
});
});
控制器代码:
public ActionResult IncreasedMeasuring(int NursingRecordID, string MeasuringTime, string AnimalHeat, string Pulse, string Breathe, string BloodPressure)
{
string strMsg = "failed";
try
{
SYS_Measuring myMeasuring = new SYS_Measuring();
myMeasuring.NursingRecordID = NursingRecordID;//护理记录ID
myMeasuring.MeasuringTime = MeasuringTime;//测量时间
myMeasuring.AnimalHeat = AnimalHeat;//体温
myMeasuring.Pulse = Pulse;//脉搏
myMeasuring.Breathe = Breathe;//呼吸
myMeasuring.BloodPressure = BloodPressure;//血压
myModels.SYS_Measuring.Add(myMeasuring);
//保存数据库
myModels.SaveChanges();
strMsg = "success";
}
catch (Exception)
{
strMsg = "failed";
}
return Json(strMsg, JsonRequestBehavior.AllowGet);
}