예제 #1
0
        public void Delete(int id)
        {
            var foundDepartment = _repository.GetById(id);

            if (foundDepartment == null)
            {
                throw new ArgumentNullException(nameof(foundDepartment));
            }
            _repository.Delete(foundDepartment);
        }
예제 #2
0
        public async Task <IActionResult> DeleteDepartment([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var department = await _context.GetById(id);

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

            await _context.Delete(department);


            return(Ok(department));
        }
 public IActionResult DoDelete(int id)
 {
     repo.Delete(id);
     return(RedirectToAction("Index"));
 }
        public IActionResult Delete([FromBody] Department DeleteDepartment)
        {
            var retval = repo.Delete(DeleteDepartment.Id);

            return(StatusCode(StatusCodes.Status200OK, retval));
        }
 public IActionResult DeleteDepartment(int id)
 {
     _deptRepo.Delete(id);
     return(NoContent());
 }