public composition Add6(int id, composition question) { // 向试题表里增加试题 question = db.composition.Add(question); include_question_between_bank_and_composition tmp = new include_question_between_bank_and_composition { BankID = id, QuestionID = question.ID }; // 向题库里增加试题 db.include_question_between_bank_and_composition.Add(tmp); db.SaveChanges(); return(question); }
public bool Update6(int id, composition question) { composition tmp = db.composition.Where(p => p.ID == id).FirstOrDefault(); if (tmp != null) { // 修改 tmp.Content = question.Content; tmp.Answer = question.Answer; tmp.Score = question.Score; db.SaveChanges(); return(true); } else { return(false); } }