新增专业
控制器
#region 新增专业
public ActionResult InsertSpecialty(int AcademeID, string SpecialtyName, string SpecialtyCode)// 新增专业
{
SYS_Specialty modSpecialty = new SYS_Specialty();
ReturnJson msg = new ReturnJson();
if (AcademeID != 0 && !string.IsNullOrEmpty(SpecialtyName) && !string.IsNullOrEmpty(SpecialtyCode))
{
modSpecialty.AcademeID = AcademeID;
modSpecialty.SpecialtyName = SpecialtyName;
modSpecialty.SpecialtyCode = SpecialtyCode;
ChongQing.SYS_Specialty.Add(modSpecialty);
if (ChongQing.SaveChanges() > 0)
{
msg.State = true;
msg.Text = "新增成功!";
}
else
{
msg.Text = "新增失败!";
}
}
else
{
msg.Text = "专业名称或专业代号不能为空!";
}
return Json(msg, JsonRequestBehavior.AllowGet);// 新增专业
}
#endregion
JavaScript