insurerregservice/src/main/java/com/stackroute/pie/controller/InsurerController.java
//Method for deleting an existing policy
Method for deleting an existing policy
Method for deleting an existing policy
@PutMapping("/policy/delete/{insurerName}/{policyId}")
    public ResponseEntity<?> deletePolicy(@PathVariable(value = "insurerName") String insurerName, @PathVariable(value = "policyId") long policyId){
        if (insurerRepository.existsByInsurerName(insurerName) == false) {
            return new ResponseEntity<>(new ResponseMessage("Insurer Not Found"),
                    HttpStatus.NOT_FOUND);
        }
        System.out.println("InsurerLicence : "+insurerName + " " +"policyId : "+policyId);
        Insurer insurer = insurerService.deletePolicy(insurerName,policyId);
        return new ResponseEntity<Insurer>(insurer, HttpStatus.OK);
    }
@ PutMapping ( "/policy/delete/{insurerName}/{policyId}" ) public ResponseEntity < ? > deletePolicy ( @ PathVariable ( value = "insurerName" ) String insurerName , @ PathVariable ( value = "policyId" ) long policyId ) { if ( insurerRepository . existsByInsurerName ( insurerName ) == false ) { return new ResponseEntity < > ( new ResponseMessage ( "Insurer Not Found" ) , HttpStatus . NOT_FOUND ) ; } System . out . println ( "InsurerLicence : " + insurerName + " " + "policyId : " + policyId ) ; Insurer insurer = insurerService . deletePolicy ( insurerName , policyId ) ; return new ResponseEntity < Insurer > ( insurer , HttpStatus . OK ) ; }
Method for deleting an existing policy
Method for deleting an existing policy