public string Edit() { tbStu stuInfo = new tbStu(); var StuNo = Request["id"]; var StuName = Request["StuName"]; var StuGrade = Request["SruGrade"]; var StuTel = Request["StuTel"]; decimal StuCredit = Convert.ToDecimal(Request["StuCredit"]); var StuMajor = Request["StuMajor"]; stuInfo = stu.GetModel(StuNo); JPGL.Model.tbMajor majormodel = new JPGL.Model.tbMajor(); if (StuMajor == stuInfo.tbMajor.MajorName) { majormodel = major.GetModel(StuMajor); } else { int MajorNo = int.Parse(StuMajor); majormodel = major.GetModel(MajorNo); } stuInfo.StuName = StuName; stuInfo.StuNo = StuNo; stuInfo.StuGrade = StuGrade; stuInfo.StuTel = StuTel; stuInfo.StuCredit = StuCredit; stuInfo.tbMajor.MajorName = StuMajor; stuInfo.tbMajor = majormodel; bool b = stu.Update(stuInfo); if (b) { return("ok"); } else { return("no"); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(JPGL.Model.tbMajor model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(JPGL.Model.tbMajor model) { return(dal.Add(model)); }