using EPAServeur.Context; using EPAServeur.Exceptions; using EPAServeur.IServices; using EPAServeur.Models.EP; using IO.Swagger.ApiCollaborateur; using IO.Swagger.DTO; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace EPAServeur.Services { public class EpDetailsService : IEpDetailsService { private EpContext context; private ITransformDTO transformDTO; private ICollaborateurService collaborateurService; public EpDetailsService(EpContext context, ITransformDTO transformDTO, ICollaborateurService collaborateurService) { this.context = context; this.transformDTO = transformDTO; this.collaborateurService = collaborateurService; } public async Task GetEp(long id) { Ep ep = await context.Ep.FindAsync(id); if (ep == null) throw new EpNotFoundException(); List guids = new List(); guids.Add(ep.IdCollaborateur); if (ep.IdReferent.HasValue) guids.Add(ep.IdCollaborateur); IEnumerable collaborateurDTOs = await collaborateurService.GetCollaborateurDTOsAsync(guids) ; EpDTO epDTO = transformDTO.EpToEpDetails(ep, collaborateurDTOs); return epDTO; } public void RappelSignature(long idEp) { throw new NotImplementedException(); } public Task SaisirEPCollaborateur(Guid? idCollaborateur) { throw new NotImplementedException(); } public Task SaisirEPReferent(long idEp) { throw new NotImplementedException(); } public void SupprimerDonneesEPCollaborateur(Guid? idCollaborateur) { throw new NotImplementedException(); } public void SupprimerEP(long idEp) { throw new NotImplementedException(); } public Task UpdateEP(long idEp, EpDTO ep) { throw new NotImplementedException(); } public Task UpdateSaisie(long idEp, EpDTO ep) { throw new NotImplementedException(); } } }