[ADD] Extension ToModel/ToModels pour scientifique

pull/24/head
Renaud BEURET 1 year ago
parent 7f6ac91470
commit feee19a505

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="ModuleClassLoaderOverlays">
<paths>
<option value="/tmp/overlay10633925828874165666" />
<option value="/tmp/overlay8943318448700809082" />
<option value="/tmp/overlay8977085641070230858" />
</paths>
</component>
</module>

@ -0,0 +1,27 @@
package fr.iut.sciencequest.model.dto.extensions
import fr.iut.sciencequest.model.dto.ScientifiqueDTO
import fr.iut.sciencequest.model.metier.Scientifique
fun ScientifiqueDTO.ToModel(): Scientifique {
val model = Scientifique(
id = this.id,
descriptif = this.descriptif,
nom = this.nom,
prenom = this.photo,
photo = this.photo,
difficulte = this.difficulte.ToModel(),
sexe = this.sexe,
ratioTrouve = this.ratioTrouve,
thematique = this.thematique.ToModel()
)
return model
}
fun List<ScientifiqueDTO>.ToModel(): List<Scientifique> {
val liste = ArrayList<Scientifique>();
for (dto in this) {
liste.add(dto.ToModel())
}
return liste
}
Loading…
Cancel
Save