예제 #1
0
        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);
        }
예제 #2
0
        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);
        }