Ignore:
Timestamp:
12/26/23 18:50:43 (10 months ago)
Author:
gjoko kostadinov <gjokokostadinov@…>
Branches:
master
Children:
1413ee2
Parents:
950fa0d
Message:

Add entire code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/edu/gjoko/schedlr/services/StakeholderService.java

    • Property mode changed from 100644 to 100755
    r950fa0d r77205be  
    66import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
    77import org.springframework.stereotype.Service;
     8
     9import java.util.Optional;
    810
    911@Service
     
    2830        return stakeholderRepository.findById(id).get();
    2931    }
     32
     33    public void saveOrUpdateStakeholder(Stakeholder stakeholder) {
     34        if (stakeholder.getId() != null) {
     35            var found = stakeholderRepository.findById(stakeholder.getId()).get();
     36            found.setFirstName(stakeholder.getFirstName());
     37            found.setLastName(stakeholder.getLastName());
     38            found.setPhoneNumber(stakeholder.getPhoneNumber());
     39            found.setEmail(stakeholder.getEmail());
     40            found.setUsername(stakeholder.getUsername());
     41            stakeholderRepository.save(found);
     42        }
     43    }
    3044}
Note: See TracChangeset for help on using the changeset viewer.