policy/src/main/java/com/stackroute.pie/controller/PolicyController.java
//Delete the insuredName in the policy
Delete the insuredName in the policy
Delete the insuredName in the policy
@DeleteMapping("policy/{insurerName}/{policyName}/{insuredName}")
    public ResponseEntity<?> deleteInsured(@PathVariable(value = "insurerName") String insurerName,
                                        @PathVariable(value = "policyName") String policyName,
                                        @PathVariable(value = "insuredName") String insuredName) {
        ResponseEntity<?> responseEntity;
        try {
            Policy policy = policyService.deleteInsured(insurerName,policyName,insuredName);
            responseEntity = new ResponseEntity<Policy>(policy, HttpStatus.OK);
        } catch (InsurerNotFoundException e) {
            responseEntity = new ResponseEntity<String>(e.getMessage(),HttpStatus.NOT_FOUND);
        } catch (PolicyNotFoundException e) {
            responseEntity = new ResponseEntity<String>(e.getMessage(),HttpStatus.NOT_FOUND);
        }
        return responseEntity;
    }
@ DeleteMapping ( "policy/{insurerName}/{policyName}/{insuredName}" ) public ResponseEntity < ? > deleteInsured ( @ PathVariable ( value = "insurerName" ) String insurerName , @ PathVariable ( value = "policyName" ) String policyName , @ PathVariable ( value = "insuredName" ) String insuredName ) { ResponseEntity < ? > responseEntity ; try { Policy policy = policyService . deleteInsured ( insurerName , policyName , insuredName ) ; responseEntity = new ResponseEntity < Policy > ( policy , HttpStatus . OK ) ; } catch ( InsurerNotFoundException e ) { responseEntity = new ResponseEntity < String > ( e . getMessage ( ) , HttpStatus . NOT_FOUND ) ; } catch ( PolicyNotFoundException e ) { responseEntity = new ResponseEntity < String > ( e . getMessage ( ) , HttpStatus . NOT_FOUND ) ; } return responseEntity ; }
Delete the insuredName in the policy
Delete the insuredName in the policy