màj pour version initialeV2
This commit is contained in:
28
src/main/java/com/mycompany/bibliotheque/Métier/Emprunt.java
Normal file
28
src/main/java/com/mycompany/bibliotheque/Métier/Emprunt.java
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package com.mycompany.bibliotheque.Métier;
|
||||
|
||||
import com.mycompany.bibliotheque.Métier.Utilisateur;
|
||||
import com.mycompany.bibliotheque.Métier.Livre;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author dthev
|
||||
*/
|
||||
|
||||
public class Emprunt {
|
||||
|
||||
// TODO: logique métier d'emprunt
|
||||
public static boolean effectuerEmprunt(Utilisateur u, Livre l) {
|
||||
if (l.isEmprunte()) {
|
||||
return false; // déjà emprunté
|
||||
}
|
||||
if (u.getEmprunts().size() >= 3) {
|
||||
return false; // trop de livres empruntés
|
||||
}
|
||||
l.setEmprunte(true);
|
||||
return u.emprunterLivre(l);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user