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); }
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()); }
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); }
public void Delete(Guid id) { var lecture = _lectureRepository.GetLectureOrNull(id); _lectureRepository.DeleteLecture(lecture.Id); }
public void DeleteLecture(int lectureID) { _lectureRepository.DeleteLecture(lectureID); _lectureRepository.Save(); }
public bool Delete(int id) { _log.Info("Delete the lecture. LectureId: " + id); return(lectureRepo.DeleteLecture(id)); }