src/main/java/com/kshrd/derphsar_api/rest/restcontroller/PromotionRestController.java
/**
     * Put a promotion
     *
     * @param promoId - Id of a promotion
     * @param promotionRequestModel - Promotion request model
     * @return - Return response message
     */
Put a promotion
@param promoId - Id of a promotion
@param promotionRequestModel - Promotion request model
@return - Return response message
Put a promotion @param promoId - Id of a promotion @param promotionRequestModel - Promotion request model @return - Return response message
@PutMapping("/promotions/{promoId}")
    @ApiOperation(value = "update a promotion by a promotion id", response = PromotionResponseModel.class)
    public ResponseEntity<BaseApiResponse<PromotionResponseModel>> updatePromotion(@PathVariable("promoId") String promoId,
                                                                                  @RequestBody PromotionRequestModel promotionRequestModel) {
        ModelMapper modelMapper = new ModelMapper();
        BaseApiResponse<PromotionResponseModel> response = new BaseApiResponse<>();
        try {
            PromotionDto promotionDto = modelMapper.map(promotionRequestModel, PromotionDto.class);
            PromotionResponseModel responseModel = modelMapper.map(promotionServiceImp.updatePromotion(promoId, promotionDto), PromotionResponseModel.class);
            response.setMessage(message.updated("Promotion"));
            response.setStatus(HttpStatus.OK);
            response.setData(responseModel);
        }catch (Exception e){
            e.printStackTrace();
        }
        response.setTime(new Timestamp(System.currentTimeMillis()));
        return ResponseEntity.ok(response);
    }
@ PutMapping ( "/promotions/{promoId}" ) @ ApiOperation ( value = "update a promotion by a promotion id" , response = PromotionResponseModel . class ) public ResponseEntity < BaseApiResponse < PromotionResponseModel > > updatePromotion ( @ PathVariable ( "promoId" ) String promoId , @ RequestBody PromotionRequestModel promotionRequestModel ) { ModelMapper modelMapper = new ModelMapper ( ) ; BaseApiResponse < PromotionResponseModel > response = new BaseApiResponse < > ( ) ; try { PromotionDto promotionDto = modelMapper . map ( promotionRequestModel , PromotionDto . class ) ; PromotionResponseModel responseModel = modelMapper . map ( promotionServiceImp . updatePromotion ( promoId , promotionDto ) , PromotionResponseModel . class ) ; response . setMessage ( message . updated ( "Promotion" ) ) ; response . setStatus ( HttpStatus . OK ) ; response . setData ( responseModel ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } response . setTime ( new Timestamp ( System . currentTimeMillis ( ) ) ) ; return ResponseEntity . ok ( response ) ; }
Put a promotion
 @param promoId - Id of a promotion
 @param promotionRequestModel - Promotion request model
 @return - Return response message
Put a promotion @param promoId - Id of a promotion @param promotionRequestModel - Promotion request model @return - Return response message