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