public ActionResult GetModelById() { string stuno = Request["StuNo"]; tbStu stuInfo = new tbStu(); stuInfo = stu.GetModel(stuno); var json = Json(stuInfo, JsonRequestBehavior.AllowGet); return(json); }
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"); } }