public IActionResult DeleteComponent(int id) { //Ensure that the DELETE request is coming from the project owner var currentUser = GetCurrentUserProfile(); var checkProject = _componentRepository.CheckComponentProjectForDeleteAuth(id); if (currentUser.Id == checkProject.UserProfileId) { _projectRepository.DeleteComponent(id); return(NoContent()); } return(Unauthorized()); }