|
|
@ -1,6 +1,8 @@ |
|
|
|
using EPAServeur.IServices; |
|
|
|
using EPAServeur.Context; |
|
|
|
|
|
|
|
using EPAServeur.IServices; |
|
|
|
using EPAServeur.Models.Notes; |
|
|
|
using EPAServeur.Models.Notes; |
|
|
|
using IO.Swagger.DTO; |
|
|
|
using IO.Swagger.DTO; |
|
|
|
|
|
|
|
using IO.Swagger.ModelCollaborateur; |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
@ -10,6 +12,15 @@ namespace EPAServeur.Services |
|
|
|
{ |
|
|
|
{ |
|
|
|
public class NoteService : INoteService |
|
|
|
public class NoteService : INoteService |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
private readonly CollaborateurService collaborateurService; |
|
|
|
|
|
|
|
private readonly EpContext context; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public NoteService(CollaborateurService _collaborateurService, EpContext _context) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
collaborateurService = _collaborateurService; |
|
|
|
|
|
|
|
context = _context; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public bool AjouterNote(DetailsNoteDTO nouvelleNote) |
|
|
|
public bool AjouterNote(DetailsNoteDTO nouvelleNote) |
|
|
|
{ |
|
|
|
{ |
|
|
|
throw new NotImplementedException(); |
|
|
|
throw new NotImplementedException(); |
|
|
@ -46,20 +57,46 @@ namespace EPAServeur.Services |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Object to DTO |
|
|
|
//Object to DTO |
|
|
|
public AffichageNoteDTO NoteToAffichageDTO(Note note) |
|
|
|
private AffichageNoteDTO NoteToAffichageDTO(Note note) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return null; |
|
|
|
CollaborateurDTO collaborateur = collaborateurService.GetCollaborateurById(note.IdCollaborateur); |
|
|
|
|
|
|
|
AffichageNoteDTO affichage = new AffichageNoteDTO() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Id = note.Id, |
|
|
|
|
|
|
|
Collaborateur = collaborateur.Prenom + collaborateur.Nom, |
|
|
|
|
|
|
|
Titre = note.Titre, |
|
|
|
|
|
|
|
DateMiseAjour = note.DateUpdate |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return affichage; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public DetailsNoteDTO NoteToDetailSDTO(Note note) |
|
|
|
private DetailsNoteDTO NoteToDetailSDTO(Note note) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
DetailsNoteDTO details = new DetailsNoteDTO() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return null; |
|
|
|
Id = note.Id, |
|
|
|
|
|
|
|
DateCreation = note.DateCreation, |
|
|
|
|
|
|
|
DateMiseAjour = note.DateUpdate, |
|
|
|
|
|
|
|
Titre = note.Titre, |
|
|
|
|
|
|
|
Texte = note.Texte, |
|
|
|
|
|
|
|
IdAuteur = note.IdAuteur, |
|
|
|
|
|
|
|
Collaborateur = collaborateurService.GetCollaborateurById(note.IdCollaborateur) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return details; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//DTO to Object |
|
|
|
//DTO to Object |
|
|
|
public Note DetailsNoteDTOToNote(DetailsNoteDTO detailsNoteDTO) |
|
|
|
private Note DetailsNoteDTOToNouvelleNote(DetailsNoteDTO detailsNoteDTO) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Note note = new Note() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return null; |
|
|
|
IdAuteur = detailsNoteDTO.IdAuteur.Value, |
|
|
|
|
|
|
|
IdCollaborateur = detailsNoteDTO.Collaborateur.Id.Value, |
|
|
|
|
|
|
|
Texte = detailsNoteDTO.Texte, |
|
|
|
|
|
|
|
Titre = detailsNoteDTO.Titre, |
|
|
|
|
|
|
|
DateCreation = DateTime.Now |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
return note; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|