|
@@ -81,18 +81,18 @@ namespace TEAMModelOS.Controllers
|
|
|
|
|
|
//要檢查座號使否已被使用
|
|
|
var existNo = await checkStudNo(schoolId.GetString(), classId, new List<string>() { id });
|
|
|
- if (existNo.Count != 0) return this.Ok(new { existNo });
|
|
|
+ if (existNo.Count != 0) return this.Ok(new { code = $"Base-{schoolId.GetString()}", existNo = existNo.Select(o => o.id).ToList() });
|
|
|
|
|
|
//建立學生
|
|
|
studCreateInfo studCreateInfo = new studCreateInfo(id, name, "M", year, pw, classId, no);
|
|
|
var isCreateSuc = await createStudent(schoolId.GetString(), studCreateInfo);
|
|
|
- return this.Ok(new { code = $"Base-{schoolId.GetString()}", id, name, year, classId, no });
|
|
|
+ if (isCreateSuc) return this.Ok(new { code = $"Base-{schoolId.GetString()}", id, name, year, classId, no });
|
|
|
+ else return this.Ok(new { code = $"Base-{schoolId.GetString()}", errorId = id });
|
|
|
}
|
|
|
break;
|
|
|
case "import":
|
|
|
//只有ClassNo可以比對
|
|
|
var retUpsert = await upsertStudents(schoolId.GetString(), request.GetProperty("students").EnumerateArray());
|
|
|
- //var objClassDuplNos = retUpsert.classDuplNos.Select(o=>new {o.Key,new { id = o.Value.Select(o => o.id), no = o.Value.Select(o=>o.no) } });
|
|
|
return this.Ok(new { code = $"Base-{schoolId.GetString()}", students = retUpsert.studs, retUpsert.classDuplNos, retUpsert.errorIds });
|
|
|
case "read":
|
|
|
//讀取該間學校所有的學生資訊
|