Beispiel #1
0
        public async Task <IActionResult> DeleteInstitute(Guid instituteId)
        {
            var instututeEntity = await _instituteRepository.GetInstituteAsync(instituteId);

            if (instututeEntity == null)
            {
                return(NotFound());
            }

            _instituteRepository.DeleteInstitute(instututeEntity);

            await _instituteRepository.SaveAsync();

            return(NoContent());
        }
Beispiel #2
0
        public IActionResult DeleteInstitute(int instituteId)
        {
            if (!_insRepo.InstituteExists(instituteId))
            {
                return(NotFound());
            }

            var instituteObj = _insRepo.GetInstitute(instituteId);

            if (!_insRepo.DeleteInstitute(instituteObj))
            {
                ModelState.AddModelError("", $"Something went wrong when deleting the record {instituteObj.Name}");
                return(StatusCode(500, ModelState));
            }

            return(NoContent());
        }
 public Institute DeleteInstitute(string id)
 {
     return _repo.DeleteInstitute(id);
 }