|
|
|
@ -315,6 +315,29 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 课程ID 同步至课件 |
|
|
|
|
if (!entity.CourseWareId.IsNull()) |
|
|
|
|
{ |
|
|
|
|
var ware = await Db.Queryable<Ghre_CourseWare>().FirstAsync(x => x.Id == entity.CourseWareId); |
|
|
|
|
if (ware != null) |
|
|
|
|
{ |
|
|
|
|
var courseIds2 = new List<long>(); |
|
|
|
|
if (!string.IsNullOrWhiteSpace(ware.CourseIds)) |
|
|
|
|
courseIds2 = JsonConvert.DeserializeObject<List<long>>(ware.CourseIds); |
|
|
|
|
|
|
|
|
|
if (!courseIds2.Any(x => x == id)) |
|
|
|
|
{ |
|
|
|
|
courseIds2.Add(id); |
|
|
|
|
|
|
|
|
|
ware.CourseIds = JsonConvert.SerializeObject(courseIds2); |
|
|
|
|
await Db.Updateable<Ghre_CourseWare>().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
@ -381,27 +404,6 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
|
} |
|
|
|
|
var result = await base.Add(entity); |
|
|
|
|
|
|
|
|
|
#region 课程ID 同步至课件 |
|
|
|
|
if (!entity.CourseWareId.IsNull()) |
|
|
|
|
{ |
|
|
|
|
var ware = await Db.Queryable<Ghre_CourseWare>().FirstAsync(x => x.Id == entity.CourseWareId); |
|
|
|
|
if (ware != null) |
|
|
|
|
{ |
|
|
|
|
var courseIds2 = new List<long>(); |
|
|
|
|
if (!string.IsNullOrWhiteSpace(ware.CourseIds)) |
|
|
|
|
courseIds2 = JsonConvert.DeserializeObject<List<long>>(ware.CourseIds); |
|
|
|
|
|
|
|
|
|
if (!courseIds2.Any(x => x == result)) |
|
|
|
|
{ |
|
|
|
|
courseIds2.Add(result); |
|
|
|
|
|
|
|
|
|
ware.CourseIds = JsonConvert.SerializeObject(courseIds2); |
|
|
|
|
await Db.Updateable<Ghre_CourseWare>().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<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
|
editModel.IsOPen = editModel.IsOPenLabel; |
|
|
|
|
|
|
|
|
|
var result = await base.Update(Id, editModel); |
|
|
|
|
|
|
|
|
|
#region 课程ID 同步至课件 |
|
|
|
|
if (!editModel.CourseWareId.IsNull()) |
|
|
|
|
{ |
|
|
|
|
var ware = await Db.Queryable<Ghre_CourseWare>().FirstAsync(x => x.Id == editModel.CourseWareId); |
|
|
|
|
if (ware != null) |
|
|
|
|
{ |
|
|
|
|
var courseIds2 = new List<long>(); |
|
|
|
|
if (!string.IsNullOrWhiteSpace(ware.CourseIds)) |
|
|
|
|
courseIds2 = JsonConvert.DeserializeObject<List<long>>(ware.CourseIds); |
|
|
|
|
|
|
|
|
|
if (!courseIds2.Any(x => x == Id)) |
|
|
|
|
{ |
|
|
|
|
courseIds2.Add(Id); |
|
|
|
|
|
|
|
|
|
ware.CourseIds = JsonConvert.SerializeObject(courseIds2); |
|
|
|
|
await Db.Updateable<Ghre_CourseWare>().SetColumns(it => it.CourseIds == ware.CourseIds).Where(it => it.Id == ware.Id).ExecuteCommandAsync(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|