Commit f6386b46 authored by 黄奎's avatar 黄奎

新增验证

parent 59fb2487
......@@ -195,22 +195,30 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Failed(message: "请添加选择题选项!");
}
}
else if (extModel.QuestionTypeKey == "fill-in")
{
var fillInList = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(extModel.QuestionContent);
if (fillInList != null && fillInList.Count > 0)
{
if (fillInList.Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0)
{
return ApiResult.Failed(message: "请输入答案!");
}
}
else
{
return ApiResult.Failed(message: "请添加答案!");
}
}
var obj = new object();
switch (extModel.QuestionTypeKey)
{
//单选题
case "single":
break;
//多选题
case "multiple":
obj = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(extModel.QuestionContent);
break;
//填空题
case "fill-in":
obj = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(extModel.QuestionContent);
break;
//判断题
case "judge":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment