public IActionResult Delete(int id) { try { var category = _service.GetById(id); /*Deletes only parent, orphaned children get connected to parent's parent * _service.Delete(category); */ //Deletes parent and his children - i.e cascade delete _service.DeleteWithChildren(category); //Deletes parent and sets its children to be descendants of its parent //_service.DeleteWithForcedAdoption(category); return(Ok(category)); } catch (Exception ex) { return(BadRequest()); } }