コード例 #1
0
        public void DeleteFilesForGivenId(Guid id)
        {
            var lecture = _repository.GetLectureById(id);

            var searchedPath = Path.Combine(_env.WebRootPath, "Lectures/" + id);

            if (Directory.Exists(searchedPath))
            {
                Directory.Delete(searchedPath, true);
            }

            _repository.DeleteLecture(lecture);
        }
コード例 #2
0
        public async Task <IActionResult> DeleteLecture(int Lecture_Id)
        {
            if (ModelState.IsValid)
            {
                int result = await _LectureRepository.DeleteLecture(Lecture_Id);

                if (result == 1)
                {
                    TempData["Success"] = "Delete Lecture Successfully";
                    return(RedirectToAction("Index", "lecture", new { area = "teachers" }));
                }
                else
                {
                    TempData["Error"] = "Deleting Lecture Failed";
                    return(RedirectToAction("Index", "lecture", new { area = "teachers" }));
                }
            }

            return(View());
        }
コード例 #3
0
        public DeleteLectureResultDTO DeleteLecture(int id)
        {
            var lecture = _repository.GetLectureByID(id);

            if (lecture == null)
            {
                return(null);
            }

            var deleteLectureResult = new DeleteLectureResultDTO
            {
                Deleted = false,
                Lecture = Mapper.Map <GetLectureDTO>(lecture)
            };

            _repository.DeleteLecture(lecture);

            if (_repository.Save())
            {
                deleteLectureResult.Deleted = true;
            }

            return(deleteLectureResult);
        }
コード例 #4
0
ファイル: LectureService.cs プロジェクト: matm94/Femd
        public void Delete(Guid id)
        {
            var lecture = _lectureRepository.GetLectureOrNull(id);

            _lectureRepository.DeleteLecture(lecture.Id);
        }
コード例 #5
0
 public void DeleteLecture(int lectureID)
 {
     _lectureRepository.DeleteLecture(lectureID);
     _lectureRepository.Save();
 }
コード例 #6
0
        public bool Delete(int id)
        {
            _log.Info("Delete the lecture. LectureId: " + id);

            return(lectureRepo.DeleteLecture(id));
        }