public ActionResult AddTeaToTg() { string teaname = Request["teaname"]; string tgname = Request["tgname"]; string dep = Request["dep"]; TeacherService teaser = new TeacherService(); Teacher tea = teaser.GetTeacherByName(teaname); if (tea == null) { Response.Write("老师不存在"); Response.End(); return(null); } if (tea.TeaGroup != null) { Response.Write("该老师已有分组"); Response.End(); return(null); } if (tea.Department.Dep_Name != dep) { Response.Write("请选择本院的老师"); Response.End(); return(null); } if (teaser.AddTeaToTG(teaname, tgname)) { Response.Write("添加成功"); Response.End(); return(null); } ; Response.Write("添加失败"); Response.End(); return(null); }