//保存表单数据 public ActionResult SaveData(OtherOutput OtherOutput) { //参数对象可以对应接受数据 OtherOutput.MakePerson = Session["UserName"].ToString(); //保存制单人 string result = OtherOutputService.SaveData(OtherOutput); //保存数据 return(Content(result.ToString())); }
//获取表单数据 public ActionResult GetData() { string str = Request.Params["OtherOutputId"];//单号 //如果新单据 没有数据 if (string.IsNullOrEmpty(str)) { return(Json(new OtherOutput()));//返回一个新建的空对象 } //如果有数据 Guid OtherOutputId = new Guid(Request["OtherOutputId"]); //单据编号 OtherOutput bill = OtherOutputService.LoadEntities(t => t.Id == OtherOutputId).FirstOrDefault(); //获取表单 return(Json(bill)); }