public async Task <ActionResult <UniversityDTO> > Delete([FromBody] UniversityDTO universityDTO)
        {
            if (universityDTO == null)
            {
                universityDTO = new UniversityDTO();
            }

            University university = new University {
                Id = universityDTO.Id ?? default
            };

            university = await UniversityService.Delete(university);

            universityDTO = new UniversityDTO
            {
                Id      = university.Id,
                Code    = university.Code,
                Name    = university.Name,
                Address = university.Address,
                Errors  = university.Errors
            };
            if (university.HasError)
            {
                return(BadRequest(universityDTO));
            }
            return(Ok(universityDTO));
        }
        public async Task <ActionResult> Delete(int universityId)
        {
            _universityService.Delete(universityId);

            await _dbContext.SaveChangesAsync();

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
        public void Delete(short id)
        {
            var universityInDb = _universityService.GetUniversityById(id);

            if (universityInDb != null)
            {
                _universityService.Delete(universityInDb);
            }
        }
Exemplo n.º 4
0
 public void Delete(int id)
 {
     uniService.Delete(id);
 }
Exemplo n.º 5
0
        public async Task <IActionResult> Delete([FromRoute] Guid universityId)
        {
            await _universityService.Delete(universityId);

            return(NoContent());
        }