src/main/java/com/kshrd/derphsar_api/rest/restcontroller/PromotionRestController.java
/**
     * Put a promotion
     *
     * @param proId - Id of a promotion
     * @param productUpdateDiscountModel - Promotion request model
     * @return - Return response message
     */
Put a promotion
@param proId - Id of a promotion
@param productUpdateDiscountModel - Promotion request model
@return - Return response message
Put a promotion @param proId - Id of a promotion @param productUpdateDiscountModel - Promotion request model @return - Return response message
@PatchMapping("/apply-promotion/{proId}")
    @ApiOperation(value = "apply promotion", response = ProductUpdateDiscountModel.class)
    public ResponseEntity<BaseApiNoPaginationResponse<ProductUpdateDiscountModel>> applyPromotion(@PathVariable("proId") String proId,
                                                                                                  @RequestBody ProductUpdateDiscountModel productUpdateDiscountModel) {
        ModelMapper modelMapper = new ModelMapper();
        BaseApiNoPaginationResponse<ProductUpdateDiscountModel> response = new BaseApiNoPaginationResponse<>();
        try {
            ProductDto productDto = modelMapper.map(productUpdateDiscountModel, ProductDto.class);
            ProductUpdateDiscountModel responseModel = modelMapper.map(promotionServiceImp.applyPromotion(proId, productDto), ProductUpdateDiscountModel.class);
            response.setMessage(message.updated("Product"));
            response.setStatus(HttpStatus.OK);
            response.setData(responseModel);
        }catch (Exception e){
            e.printStackTrace();
        }
        response.setTime(new Timestamp(System.currentTimeMillis()));
        return ResponseEntity.ok(response);
    }
@ PatchMapping ( "/apply-promotion/{proId}" ) @ ApiOperation ( value = "apply promotion" , response = ProductUpdateDiscountModel . class ) public ResponseEntity < BaseApiNoPaginationResponse < ProductUpdateDiscountModel > > applyPromotion ( @ PathVariable ( "proId" ) String proId , @ RequestBody ProductUpdateDiscountModel productUpdateDiscountModel ) { ModelMapper modelMapper = new ModelMapper ( ) ; BaseApiNoPaginationResponse < ProductUpdateDiscountModel > response = new BaseApiNoPaginationResponse < > ( ) ; try { ProductDto productDto = modelMapper . map ( productUpdateDiscountModel , ProductDto . class ) ; ProductUpdateDiscountModel responseModel = modelMapper . map ( promotionServiceImp . applyPromotion ( proId , productDto ) , ProductUpdateDiscountModel . class ) ; response . setMessage ( message . updated ( "Product" ) ) ; 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 proId - Id of a promotion
 @param productUpdateDiscountModel - Promotion request model
 @return - Return response message
Put a promotion @param proId - Id of a promotion @param productUpdateDiscountModel - Promotion request model @return - Return response message