public string deleteProfessorToStudent(int pid, string StuID)
 {
     try
     {
         SsContext          db    = new SsContext();
         ProfessorToStudent ps    = db.ProfessorToStudents.Find(pid, StuID);
         ProfessorToStudent pts   = new ProfessorToStudent();
         List <Professor>   plist = db.Professors.Where(s => s.ProID == pid).ToList();
         if (plist[0].ProNum > 0)
         {
             plist[0].ProNum--;
         }
         if (plist.Count <= 0)
         {
             return("未知错误");
         }
         db.ProfessorToStudents.Remove(ps);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         return("操作失败");
     }
     return("操作成功");
 }
        public string addProfessorToStudent(int pid, string StuID)
        {
            SsContext db = new SsContext();

            try
            {
                ProfessorToStudent pts   = new ProfessorToStudent();
                List <Professor>   plist = db.Professors.Where(s => s.ProID == pid).ToList();
                if (plist.Count <= 0)
                {
                    return("未知错误");
                }
                Professor p   = plist[0];
                int       num = db.ProfessorToStudents.Where(s => s.ProID == pid).ToList().Count;
                if (num >= p.ProMaxNum || p.ProNum >= p.ProMaxNum)
                {
                    return("选择学生数已达最大值");
                }
                if (p.ProNum < p.ProMaxNum)
                {
                    p.ProNum++;
                }


                pts.ProID = pid;
                pts.StuID = StuID;
                db.ProfessorToStudents.Add(pts);
                db.SaveChanges();
            }catch (Exception e)
            {
                ProfessorToStudent p = db.ProfessorToStudents.Find(pid, StuID);
                if (p == null)
                {
                    return("操作失败");
                }
                else
                {
                    return("操作成功");
                }
            }
            return("操作成功");
        }