修改年级
程序员文章站
2022-04-17 15:54:13
...
修改年级
控制器
#region 修改年级
public ActionResult UpdateGrade(int AcademeID, string GradeName, int GradeID)// 修改年级
{
SYS_Grade modGrade = new SYS_Grade();
ReturnJson msg = new ReturnJson();
if (AcademeID != 0 && !string.IsNullOrEmpty(GradeName) && GradeID != 0)
{
modGrade.AcademeID = AcademeID;
modGrade.GradeID = GradeID;
modGrade.GradeName = GradeName;
ChongQing.Entry(modGrade).State = System.Data.Entity.EntityState.Modified;
if (ChongQing.SaveChanges() > 0)
{
msg.State = true;
msg.Text = "修改成功!";
}
else
{
msg.Text = "修改失败!";
}
}
else
{
msg.Text = "年级名称不能为空!";
}
return Json(msg, JsonRequestBehavior.AllowGet);// 修改年级
}
#endregion
JavaScript