Browse Source

处理移除学区报错异常

Li 2 years ago
parent
commit
74e6052237
1 changed files with 2 additions and 2 deletions
  1. 2 2
      TEAMModelBI/Controllers/BINormal/AreaRelevantController.cs

+ 2 - 2
TEAMModelBI/Controllers/BINormal/AreaRelevantController.cs

@@ -173,10 +173,10 @@ namespace TEAMModelBI.Controllers.BINormal
 
 
                     foreach (var item in teachers)
                     foreach (var item in teachers)
                     {
                     {
-                        var tchSchool = item.schools.Find(f => f.schoolId.Equals($"{schoolId}") && f.areaId.Equals($"{areaId}"));
+                        var tchSchool = item.schools.Where(f => f.schoolId.Equals($"{schoolId}")).FirstOrDefault();
                         if (tchSchool != null)
                         if (tchSchool != null)
                         {
                         {
-                            item.schools.Remove(tchSchool);
+                            tchSchool.areaId = "";
                             await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<Teacher>(item, item.id, new PartitionKey("Base"));
                             await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<Teacher>(item, item.id, new PartitionKey("Base"));
                         }
                         }
                     }
                     }