コード例 #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()));
 }