|
@@ -123,9 +123,9 @@ namespace TEAMModelOS.Controllers
|
|
|
return this.Ok();
|
|
|
case "delete":
|
|
|
//刪除學生資料及從教室學生名單內移除該學生
|
|
|
- await deleteStudents(schoolId.GetString(), request.GetProperty("students").EnumerateArray());
|
|
|
+ var sucDelIds = await deleteStudents(schoolId.GetString(), request.GetProperty("students").EnumerateArray());
|
|
|
await removeStudentFromClass(schoolId.GetString(), request.GetProperty("students").EnumerateArray());
|
|
|
- return this.Ok();
|
|
|
+ return this.Ok(new { ids = sucDelIds });
|
|
|
default:
|
|
|
return BadRequest();
|
|
|
}
|
|
@@ -758,9 +758,19 @@ namespace TEAMModelOS.Controllers
|
|
|
while (students.MoveNext())
|
|
|
{
|
|
|
JsonElement student = students.Current;
|
|
|
- string id = student.GetProperty("id").GetString();
|
|
|
- string classId = student.GetProperty("class").GetString();
|
|
|
- if (classStudent.ContainsKey(classId)) classStudent[classId].Add(id);
|
|
|
+ string id, classId = string.Empty;
|
|
|
+ if (student.TryGetProperty("id", out var tmpId) && !string.IsNullOrWhiteSpace(tmpId.GetString()))
|
|
|
+ {
|
|
|
+ id = tmpId.GetString();
|
|
|
+ }
|
|
|
+ else continue;
|
|
|
+
|
|
|
+ if (student.TryGetProperty("classId", out var tmpClassId) && !string.IsNullOrWhiteSpace(tmpClassId.GetString()))
|
|
|
+ {
|
|
|
+ classId = tmpClassId.GetString();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!string.IsNullOrWhiteSpace(classId) && classStudent.ContainsKey(classId)) classStudent[classId].Add(id);
|
|
|
else classStudent.Add(classId, new List<string>() { id });
|
|
|
}
|
|
|
|