//保存表单数据 public ActionResult SaveData(OtherExpenseList OtherExpenseList) { if (Session["billType"] == null)//是否有单据类型 { return(Content("没有单据类型!")); } int billtype = Convert.ToInt32(Session["billType"].ToString().Trim()); //参数对象可以对应接受数据 OtherExpenseList.MakePerson = Session["UserName"].ToString(); //保存制单人 string result = OtherExpenseListService.SaveData(OtherExpenseList, billtype); //保存数据 return(Content(result.ToString())); }
//获取表单数据 public ActionResult GetData() { //if (Session["billType"] == null)//是否有单据类型 //{ // return Content("没有单据类型!"); //} string str = Request.Params["OtherExpenseListId"];//单号 //如果新单据 没有数据 if (string.IsNullOrEmpty(str)) { return(Json(new OtherExpenseList()));//返回一个新建的空对象 } // int billtype = Convert.ToInt32(Session["billType"].ToString().Trim()); //如果有数据 Guid OtherExpenseListId = new Guid(str); //单据编号 OtherExpenseList bill = OtherExpenseListService.LoadEntities(t => t.Id == OtherExpenseListId).FirstOrDefault(); //获取表单 return(Json(bill)); }