Example #1
0
 public async Task DeleteLesson(long LessonId)
 {
     using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.SoftDelete))
     {
         var a = WorkScope.GetAll <Lesson>().Where(s => s.Id == LessonId).Select(s => s).FirstOrDefault();
         WorkScope.SoftDeleteAsync <Lesson>(a);
     }
 }
Example #2
0
 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");
     }
 }