package com.itsol.quantrivanphong.employee.bussiness;

import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.repository.EmployeeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class EmployeeBussiness {
    @Autowired
    EmployeeRepository employeeRepository;
//    public List<Employee> findAll(){
//        return employeeRepository.findAll();
//    }
//
    public Optional<Employee> findById(int newsId){
        return  employeeRepository.findById(newsId);
    }
//    public User save(User user){
//        return userRepository.save(user);
//    }
//    public User updateUser(Long newsId, User signUpDTO){
//        User user = userRepository.findUserById(newsId);
//        user.setUsername(signUpDTO.getUsername());
//        user.setPassword(signUpDTO.getPassword());
//        user.setEmail(signUpDTO.getEmail());
//        user.setFullname(signUpDTO.getFullname());
//        user.setImage(signUpDTO.getImage());
//        user.setKnowledge(signUpDTO.getKnowledge());
//        user.setUniversity(signUpDTO.getUniversity());
//        user.setPhonenumber(signUpDTO.getPhonenumber());
//        user.setPosition(signUpDTO.getPosition());
//        user.setVillage(signUpDTO.getVillage());
//        user.setYearOfGraduation(signUpDTO.getYearOfGraduation());
//        user.setRole(signUpDTO.getRole());
//        return userRepository.save(user);
//    }
//
//    public void deleteUser(Long newsId){
//        userRepository.deleteById(newsId);
//    }
}
