|
@@ -182,15 +182,19 @@ namespace TEAMModelOS.Controllers
|
|
if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
if (!request.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
if (!request.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
|
|
if (!request.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
|
|
Syllabus syllabus = null;
|
|
Syllabus syllabus = null;
|
|
- if (scope.ToString().Equals("school"))
|
|
|
|
- {
|
|
|
|
- syllabus = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<Syllabus>(id.ToString(), new PartitionKey($"Syllabus-{code}"));
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- syllabus = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<Syllabus>(id.ToString(), new PartitionKey($"Syllabus-{code}"));
|
|
|
|
|
|
+ try {
|
|
|
|
+ if (scope.ToString().Equals("school"))
|
|
|
|
+ {
|
|
|
|
+ syllabus = await client.GetContainer("TEAMModelOS", "School").ReadItemAsync<Syllabus>(id.ToString(), new PartitionKey($"Syllabus-{code}"));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ syllabus = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<Syllabus>(id.ToString(), new PartitionKey($"Syllabus-{code}"));
|
|
|
|
+ }
|
|
|
|
+ return Ok(new { syllabus });
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ return Ok(new { syllabus });
|
|
}
|
|
}
|
|
- return Ok(new { syllabus });
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|