src/main/java/com/kshrd/derphsar_api/rest/restcontroller/UserRestController.java
/**
     * Put a user
     *
     * @param userId - Id of a user
     * @param userRequestModel - User request model
     * @return - Return response message
     */
Put a user
@param userId - Id of a user
@param userRequestModel - User request model
@return - Return response message
Put a user @param userId - Id of a user @param userRequestModel - User request model @return - Return response message
@PutMapping("/users/{userId}")
    @ApiOperation(value = "update a user by Id", response = UserResponseModel.class)
    public ResponseEntity<BaseApiNoPaginationResponse<UserResponseModel>> updateUserById(
            @PathVariable("userId") String userId,
            @RequestBody UserRequestModel userRequestModel){
        BaseApiNoPaginationResponse<UserResponseModel> response = new BaseApiNoPaginationResponse <>();
        ModelMapper modelMapper = new ModelMapper();
        try {
            UserDto dto = modelMapper.map(userRequestModel, UserDto.class);
            UserResponseModel responseModel = modelMapper.map(userServiceImp.updateUserById(userId,dto),UserResponseModel.class);
            response.setMessage(message.updated("User"));
            response.setStatus(HttpStatus.OK);
            response.setData(responseModel);
        }catch (Exception e){
            e.printStackTrace();
        }
        response.setTime(new Timestamp(System.currentTimeMillis()));
        return ResponseEntity.ok(response);
    }
@ PutMapping ( "/users/{userId}" ) @ ApiOperation ( value = "update a user by Id" , response = UserResponseModel . class ) public ResponseEntity < BaseApiNoPaginationResponse < UserResponseModel > > updateUserById ( @ PathVariable ( "userId" ) String userId , @ RequestBody UserRequestModel userRequestModel ) { BaseApiNoPaginationResponse < UserResponseModel > response = new BaseApiNoPaginationResponse < > ( ) ; ModelMapper modelMapper = new ModelMapper ( ) ; try { UserDto dto = modelMapper . map ( userRequestModel , UserDto . class ) ; UserResponseModel responseModel = modelMapper . map ( userServiceImp . updateUserById ( userId , dto ) , UserResponseModel . class ) ; response . setMessage ( message . updated ( "User" ) ) ; response . setStatus ( HttpStatus . OK ) ; response . setData ( responseModel ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } response . setTime ( new Timestamp ( System . currentTimeMillis ( ) ) ) ; return ResponseEntity . ok ( response ) ; }
Put a user
 @param userId - Id of a user
 @param userRequestModel - User request model
 @return - Return response message
Put a user @param userId - Id of a user @param userRequestModel - User request model @return - Return response message