Open cprakashb opened 5 years ago
@Override public Products saveProduct(Products products) throws ProductAlreadyExistsException {
if(productRepository.existsById(products.getProductId())){ throw new ProductAlreadyExistsException("Products already exists"); } Products savedProducts = productRepository.save(products); if(savedProducts ==null){ throw new ProductAlreadyExistsException("Products already exist"); } return savedProducts; }
@Override public Products saveProduct(Products products) throws ProductAlreadyExistsException {