public ResultEntity alterExerciseChoice(ExerciseChoice exerciseChoice) { ResultEntity resultEntity = new ResultEntity(); if (exerciseChoice != null) { //fragile ExerciseChoice exerciseChoice1 = ExerciseChoiceApi.getByID(int.Parse(exerciseChoice.exerciceChoiceId)); if (exerciseChoice1 != null) { resultEntity.setData(ExerciseChoiceApi.insert(exerciseChoice)); resultEntity.setState(1); resultEntity.setMessage("选项修改成功!"); } else { resultEntity.setMessage("未找到对应选项!"); resultEntity.setState(0); } } else { resultEntity.setMessage("传入参数为空!"); resultEntity.setState(0); } return(resultEntity); }
public ResultEntity addExerciseChoice(ExerciseChoice exerciseChoice) { ResultEntity resultEntity = new ResultEntity(); if (exerciseChoice != null) { resultEntity.setData(ExerciseChoiceApi.insert(exerciseChoice)); if (resultEntity.getData() != null) { resultEntity.setState(1); resultEntity.setMessage("创建选项成功!"); } else { resultEntity.setMessage("创建选项失败!"); resultEntity.setState(0); } } else { resultEntity.setMessage("传入参数为空!"); resultEntity.setState(0); } return(resultEntity); }