예제 #1
0
        public IActionResult DeleteUniversity(int id)
        {
            if (!_repo.UniversityExists(id))
            {
                return(NotFound());
            }
            var uni = _repo.GetById(id);

            if (!_repo.DeleteUniversity(uni))
            {
                ModelState.AddModelError("Error !", $"Something went wrong when deleting the record {uni.Name}");
                return(StatusCode(500, ModelState));
            }
            return(NoContent());
        }
예제 #2
0
 private void DeleteUniversity(int id)
 {
     _uniRep.DeleteUniversity(id);
     _fileRep.DeleteFolder(Path.Combine(StoragePath, id.ToString()));
 }