backend/buisnesslogic/src/main/java/com/plannaplan/services/LecturerService.java

32 lines
780 B
Java
Executable File

package com.plannaplan.services;
import java.util.Optional;
import com.plannaplan.entities.Lecturer;
import com.plannaplan.repositories.LecturerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class LecturerService {
@Autowired
private LecturerRepository repo;
public Optional<Lecturer> getLecturer(String title, String name, String surname) {
return repo.find(title, name, surname);
}
public Lecturer save(Lecturer lecturer) {
repo.save(lecturer);
return lecturer;
}
public void delete(Lecturer lecturer) {
repo.delete(lecturer);
}
public int getLecturersAmmount() {
return (int) this.repo.count();
}
}