Ejemplo n.º 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);
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
        public void Delete(Guid id)
        {
            var lecture = _lectureRepository.GetLectureOrNull(id);

            _lectureRepository.DeleteLecture(lecture.Id);
        }
Ejemplo n.º 5
0
 public void DeleteLecture(int lectureID)
 {
     _lectureRepository.DeleteLecture(lectureID);
     _lectureRepository.Save();
 }
Ejemplo n.º 6
0
        public bool Delete(int id)
        {
            _log.Info("Delete the lecture. LectureId: " + id);

            return(lectureRepo.DeleteLecture(id));
        }