diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs index 5bb49026..fa9f7b27 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs @@ -315,6 +315,29 @@ public class Ghre_CourseServices : BaseServices().FirstAsync(x => x.Id == entity.CourseWareId); + if (ware != null) + { + var courseIds2 = new List(); + if (!string.IsNullOrWhiteSpace(ware.CourseIds)) + courseIds2 = JsonConvert.DeserializeObject>(ware.CourseIds); + + if (!courseIds2.Any(x => x == id)) + { + courseIds2.Add(id); + + ware.CourseIds = JsonConvert.SerializeObject(courseIds2); + await Db.Updateable().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); + } + } + } + #endregion } #endregion @@ -380,28 +403,7 @@ public class Ghre_CourseServices : BaseServices().FirstAsync(x => x.Id == entity.CourseWareId); - if (ware != null) - { - var courseIds2 = new List(); - if (!string.IsNullOrWhiteSpace(ware.CourseIds)) - courseIds2 = JsonConvert.DeserializeObject>(ware.CourseIds); - - if (!courseIds2.Any(x => x == result)) - { - courseIds2.Add(result); - - ware.CourseIds = JsonConvert.SerializeObject(courseIds2); - await Db.Updateable().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); - } - } - } - #endregion - + return result; } @@ -445,27 +447,6 @@ public class Ghre_CourseServices : BaseServices().FirstAsync(x => x.Id == editModel.CourseWareId); - if (ware != null) - { - var courseIds2 = new List(); - if (!string.IsNullOrWhiteSpace(ware.CourseIds)) - courseIds2 = JsonConvert.DeserializeObject>(ware.CourseIds); - - if (!courseIds2.Any(x => x == Id)) - { - courseIds2.Add(Id); - - ware.CourseIds = JsonConvert.SerializeObject(courseIds2); - await Db.Updateable().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); - } - } - } - #endregion return result; } diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs index 1d08397d..ebdcd7ff 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseWareServices.cs @@ -74,7 +74,13 @@ public class Ghre_CourseWareServices : BaseServices>(courseIds); + if (result.result.DT_TableDataT1[0].CourseIds2.Any()) + { + + } + } else result.result.DT_TableDataT1[0].CourseIds2 = new List();