public async Task DeleteCourse(long CourseId) { if (CheckPerMissionCourse(AbpSession.UserId ?? 0, CourseId)) { var a = WorkScope.GetAll <Course>().Where(s => s.Id == CourseId).Select(s => s).FirstOrDefault(); var b = WorkScope.GetAll <Lesson>().Where(s => s.CourseId == CourseId).Select(s => s); WorkScope.SoftDeleteAsync <Course>(a); foreach (var i in b) { WorkScope.SoftDelete <Lesson>(i); } } else { throw new UserFriendlyException("Bạn không có quyền thực hiện chức năng này"); } }