diff --git a/EPAServeur.Tests/Services/FormationServiceTests.cs b/EPAServeur.Tests/Services/FormationServiceTests.cs index 3df9aee..76e130e 100644 --- a/EPAServeur.Tests/Services/FormationServiceTests.cs +++ b/EPAServeur.Tests/Services/FormationServiceTests.cs @@ -544,14 +544,14 @@ namespace EPAServeur.Tests.Services public void AddFormation_AjouteUneFormationValide_FormationAjouteeAvecSucces(int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationDTO formation = new FormationDTO { @@ -597,14 +597,14 @@ namespace EPAServeur.Tests.Services public async Task AddFormationAsync_AjouteUneFormationValide_FormationAjouteeAvecSucces(int? idMode, int? idStatut, int? idType, long? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationDTO formation = new FormationDTO { @@ -693,14 +693,14 @@ namespace EPAServeur.Tests.Services { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationDTO formation = new FormationDTO { @@ -742,14 +742,14 @@ namespace EPAServeur.Tests.Services { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationDTO formation = new FormationDTO { @@ -876,14 +876,14 @@ namespace EPAServeur.Tests.Services public void UpdateFormation_ModifieUneFormationValide_FormationModifieeAvecSucces(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationService formationService = new FormationService(epContext); @@ -927,14 +927,14 @@ namespace EPAServeur.Tests.Services public async Task UpdateFormationAsync_ModifieUneFormationValide_FormationModifieeAvecSucces(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationService formationService = new FormationService(epContext); @@ -991,14 +991,14 @@ namespace EPAServeur.Tests.Services { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationService formationService = new FormationService(epContext); @@ -1041,14 +1041,14 @@ namespace EPAServeur.Tests.Services { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationService formationService = new FormationService(epContext); @@ -1079,14 +1079,14 @@ namespace EPAServeur.Tests.Services public void UpdateFormation_ModifieUneFormationAvecUnIdIncorrecte_LeveUneFormationIncompatibleIdException(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationService formationService = new FormationService(epContext); @@ -1118,14 +1118,14 @@ namespace EPAServeur.Tests.Services public async Task UpdateFormationAsync_ModifieUneFormationAvecUnIdIncorrecte_LeveUneFormationIncompatibleIdException(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationService formationService = new FormationService(epContext); @@ -1156,14 +1156,14 @@ namespace EPAServeur.Tests.Services public void UpdateFormation_ModifieUneFormationAvecUnIdInexistant_RetourneUnObjetNull(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationService formationService = new FormationService(epContext); @@ -1195,14 +1195,14 @@ namespace EPAServeur.Tests.Services public async Task UpdateFormationAsync_ModifieUneFormationAvecUnIdInexistant_RetourneUnObjetNull(long? idFormation, int? idMode, int? idStatut, int? idType, int? idOrigine, long? idAgence, string intitule, string organisme, DateTime? dateDebut, DateTime? dateFin) { // Arrange - ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.Id == idMode) - .Select(mode => new ModeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.Id == idStatut) - .Select(mode => new StatutFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.Id == idType) - .Select(mode => new TypeFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); - OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.Id == idOrigine) - .Select(mode => new OrigineFormationDTO { Id = mode.Id, Libelle = mode.Libelle }).FirstOrDefault(); + ModeFormationDTO modeExterne = epContext.ModeFormation.Where(mode => mode.IdModeFormation == idMode) + .Select(mode => new ModeFormationDTO { Id = mode.IdModeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + StatutFormationDTO statutPlanifie = epContext.StatutFormation.Where(mode => mode.IdStatutFormation == idStatut) + .Select(mode => new StatutFormationDTO { Id = mode.IdStatutFormation, Libelle = mode.Libelle }).FirstOrDefault(); + TypeFormationDTO typeELearning = epContext.TypeFormation.Where(mode => mode.IdTypeFormation == idType) + .Select(mode => new TypeFormationDTO { Id = mode.IdTypeFormation, Libelle = mode.Libelle }).FirstOrDefault(); + OrigineFormationDTO origineFormationCollaborateur = epContext.OrigineFormation.Where(mode => mode.IdOrigineFormation == idOrigine) + .Select(mode => new OrigineFormationDTO { Id = mode.IdOrigineFormation, Libelle = mode.Libelle }).FirstOrDefault(); FormationService formationService = new FormationService(epContext); @@ -1246,7 +1246,7 @@ namespace EPAServeur.Tests.Services // Act FormationDTO formationSupprime = formationService.DeleteFormationById(idFormation); - existFormation = epContext.Formation.Any(formation => formation.Id == formationSupprime.Id.Value); + existFormation = epContext.Formation.Any(formation => formation.IdFormation == formationSupprime.Id.Value); // Assert Assert.IsFalse(existFormation); @@ -1263,7 +1263,7 @@ namespace EPAServeur.Tests.Services // Act FormationDTO formationSupprime = await formationService.DeleteFormationByIdAsync(idFormation); - existFormation = await epContext.Formation.AnyAsync(formation => formation.Id == formationSupprime.Id.Value); + existFormation = await epContext.Formation.AnyAsync(formation => formation.IdFormation == formationSupprime.Id.Value); // Assert Assert.IsFalse(existFormation); diff --git a/EPAServeur/Context/EpContext.cs b/EPAServeur/Context/EpContext.cs index ef8dc63..af067e7 100644 --- a/EPAServeur/Context/EpContext.cs +++ b/EPAServeur/Context/EpContext.cs @@ -33,11 +33,10 @@ namespace EPAServeur.Context public DbSet DemandeFormation { get; set; } public DbSet Formation { get; set; } public DbSet ModeFormation { get; set; } - public DbSet OrigineDemandeFormation { get; set; } + public DbSet OrigineDemandeFormation { get; set; } public DbSet OrigineFormation { get; set; } public DbSet ParticipationFormation { get; set; } public DbSet StatutFormation { get; set; } - public DbSet Theme { get; set; } public DbSet TypeFormation { get; set; } //Note @@ -129,62 +128,55 @@ namespace EPAServeur.Context //Formation modelBuilder.Entity(entity => { - entity.HasKey(e => e.Id); - entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasKey(e => e.IdDemandeFormation); + entity.Property(e => e.IdDemandeFormation).ValueGeneratedOnAdd(); }); modelBuilder.Entity(entity => { - entity.HasKey(e => e.Id); - entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasKey(e => e.IdFormation); + entity.Property(e => e.IdFormation).ValueGeneratedOnAdd(); }); modelBuilder.Entity(entity => { - entity.HasKey(e => e.Id); - entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasKey(e => e.IdModeFormation); + entity.Property(e => e.IdModeFormation).ValueGeneratedOnAdd(); entity.HasIndex(e => e.Libelle).IsUnique(); }); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { - entity.HasKey(e => e.Id); - entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasKey(e => e.IdOrigineDemande); + entity.Property(e => e.IdOrigineDemande).ValueGeneratedOnAdd(); entity.HasIndex(e => e.Libelle).IsUnique(); }); modelBuilder.Entity(entity => { - entity.HasKey(e => e.Id); - entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasKey(e => e.IdOrigineFormation); + entity.Property(e => e.IdOrigineFormation).ValueGeneratedOnAdd(); entity.HasIndex(e => e.Libelle).IsUnique(); }); modelBuilder.Entity(entity => { - entity.HasKey(e => e.Id); - entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasKey(e => e.IdParticipationFormation); + entity.Property(e => e.IdParticipationFormation).ValueGeneratedOnAdd(); entity.HasMany(e => e.Evaluation).WithOne(e => e.ParticipationFormation); }); modelBuilder.Entity(entity => { - entity.HasKey(e => e.Id); - entity.Property(e => e.Id).ValueGeneratedOnAdd(); - entity.HasIndex(e => e.Libelle).IsUnique(); - }); - - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Id); - entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasKey(e => e.IdStatutFormation); + entity.Property(e => e.IdStatutFormation).ValueGeneratedOnAdd(); entity.HasIndex(e => e.Libelle).IsUnique(); }); modelBuilder.Entity(entity => { - entity.HasKey(e => e.Id); - entity.Property(e => e.Id).ValueGeneratedOnAdd(); + entity.HasKey(e => e.IdTypeFormation); + entity.Property(e => e.IdTypeFormation).ValueGeneratedOnAdd(); entity.HasIndex(e => e.Libelle).IsUnique(); }); diff --git a/EPAServeur/Models/Formation/DemandeFormation.cs b/EPAServeur/Models/Formation/DemandeFormation.cs index 9e4af3d..42306dc 100644 --- a/EPAServeur/Models/Formation/DemandeFormation.cs +++ b/EPAServeur/Models/Formation/DemandeFormation.cs @@ -1,4 +1,5 @@ using EPAServeur.Models.EP; +using IO.Swagger.Enum; using System; using System.Collections.Generic; using System.Linq; @@ -6,17 +7,66 @@ using System.Threading.Tasks; namespace EPAServeur.Models.Formation { + /// + /// Demande de formation effectuées par le référent à la suite de l’EP. + /// public class DemandeFormation { - public long Id { get; set; } + /// + /// Id de la demande de formation + /// + public long IdDemandeFormation { get; set; } + + /// + /// Libellé de la demande de formation + /// + public string Libelle { get; set; } + + /// + /// Description détaillée de la demande de formation + /// public string Description { get; set; } - public DateTime DateDemande { get; set; } + + + /// + /// Indique s’il s’agit d’une demande de formation créée par une RH ou non + /// public bool DemandeRH { get; set; } - public bool? Reponse { get; set; } + + /// + /// Date à laquelle la demande a été effectuée + /// + public DateTime DateDemande { get; set; } + + + /// + /// Etat de la demande de formation + /// + public EtatDemande Etat { get; set; } + + /// + /// Commentaire expliquant la raison pour laquelle la demande de formation a été refusée + /// public string CommentaireRefus { get; set; } - public DateTime DateDerniereReponse { get; set; } + + /// + /// Date à laquelle la demande de formation a reçu une réponse pour la dernière fois + /// + public DateTime? DateDerniereReponse { get; set; } + + /// + /// Ep qui est lié à la demande de formation + /// public Ep Ep { get; set; } + + /// + /// Participation d’un collaborateur à une formation qui est liée à la demande de formation + /// public ParticipationFormation ParticipationFormation { get; set; } + + /// + /// Origine de formation qui est liée à la demande de formation + /// public OrigineFormation OrigineFormation { get; set; } } } diff --git a/EPAServeur/Models/Formation/Formation.cs b/EPAServeur/Models/Formation/Formation.cs index b533ce9..5c51cdd 100644 --- a/EPAServeur/Models/Formation/Formation.cs +++ b/EPAServeur/Models/Formation/Formation.cs @@ -5,20 +5,80 @@ using System.Threading.Tasks; namespace EPAServeur.Models.Formation { + /// + /// Formation pour les collaborateurs. + /// public class Formation { - public long Id { get; set; } + /// + /// Id de la formation + /// + public long IdFormation { get; set; } + + /// + /// Intitulé de la formation + /// public string Intitule { get; set; } + + /// + /// Id de l’agence de la RH qui a créé la formation + /// public long IdAgence { get; set; } + + /// + /// + /// public DateTime DateDebut { get; set; } + + /// + /// + /// public DateTime DateFin { get; set; } + + /// + /// Nombre de jours total de formation + /// public int Jour { get; set; } + + /// + /// Nombre d’heure total de formation + /// public int Heure { get; set; } + + /// + /// Organisme en charge d’effectuer la formation + /// public string Organisme { get; set; } + + /// + /// Indique qu’il s’agit d’une formation certifiée ou non + /// public bool EstCertifiee { get; set; } + + + /// + /// Indique que la formation a bien été effectuée ou non + /// + public bool EstRealisee { get; set; } + + /// + /// Statut de formation qui est lié à la formation + /// public StatutFormation Statut { get; set; } + + /// + /// Origine de formation qui est liée à la formation + /// public OrigineFormation Origine { get; set; } + + /// + /// Mode de formation qui est lié à la formation + /// public ModeFormation ModeFormation { get; set; } + + /// + /// Type de formation qui est lié à la formation + /// public TypeFormation TypeFormation { get; set; } } } diff --git a/EPAServeur/Models/Formation/ModeFormation.cs b/EPAServeur/Models/Formation/ModeFormation.cs index 8b05493..feaa768 100644 --- a/EPAServeur/Models/Formation/ModeFormation.cs +++ b/EPAServeur/Models/Formation/ModeFormation.cs @@ -5,10 +5,24 @@ using System.Threading.Tasks; namespace EPAServeur.Models.Formation { + /// + /// Mode d’une formation. + /// public class ModeFormation { - public int Id { get; set; } + /// + /// Id du mode de la formation + /// + public int IdModeFormation { get; set; } + + /// + /// Libellé du mode de la formation + /// public string Libelle { get; set; } + + /// + /// Formations qui sont liées au mode + /// public List Formations { get; set; } } } diff --git a/EPAServeur/Models/Formation/OrigineDemande.cs b/EPAServeur/Models/Formation/OrigineDemande.cs new file mode 100644 index 0000000..381b779 --- /dev/null +++ b/EPAServeur/Models/Formation/OrigineDemande.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace EPAServeur.Models.Formation +{ + /// + /// Raison pour laquelle la demande de formation a été faite. + /// + public class OrigineDemande + { + /// + /// Id de l’origine de la demande de formation + /// + public int IdOrigineDemande { get; set; } + + /// + /// Libellé de l’origine de la demande de formation + /// + public string Libelle { get; set; } + + /// + /// Liste des demandes de formation qui sont liées à l'origine de formation + /// + public List DemandeFormations { get; set; } + } +} diff --git a/EPAServeur/Models/Formation/OrigineDemandeFormation.cs b/EPAServeur/Models/Formation/OrigineDemandeFormation.cs deleted file mode 100644 index e3fc102..0000000 --- a/EPAServeur/Models/Formation/OrigineDemandeFormation.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace EPAServeur.Models.Formation -{ - public class OrigineDemandeFormation - { - public int Id { get; set; } - public string Libelle { get; set; } - public List DemandeFormations { get; set; } - } -} diff --git a/EPAServeur/Models/Formation/OrigineFormation.cs b/EPAServeur/Models/Formation/OrigineFormation.cs index 07b87b8..3d3c7a5 100644 --- a/EPAServeur/Models/Formation/OrigineFormation.cs +++ b/EPAServeur/Models/Formation/OrigineFormation.cs @@ -5,10 +5,24 @@ using System.Threading.Tasks; namespace EPAServeur.Models.Formation { + /// + /// Origine d’une formation. + /// public class OrigineFormation { - public int Id { get; set; } + /// + /// Id de l’origine de la formation + /// + public int IdOrigineFormation { get; set; } + + /// + /// Libellé de l’origine de la formation + /// public string Libelle { get; set; } + + /// + /// Formations qui sont liées à l'origine + /// public List Formations { get; set; } } } diff --git a/EPAServeur/Models/Formation/ParticipationFormation.cs b/EPAServeur/Models/Formation/ParticipationFormation.cs index fbeac42..b6ebea3 100644 --- a/EPAServeur/Models/Formation/ParticipationFormation.cs +++ b/EPAServeur/Models/Formation/ParticipationFormation.cs @@ -6,14 +6,44 @@ using System.Threading.Tasks; namespace EPAServeur.Models.Formation { + /// + /// Représentation de la participation d’un collaborateur à une formation. + /// public class ParticipationFormation { - public long Id { get; set; } + /// + /// Id de la participation à la formation + /// + public long IdParticipationFormation { get; set; } + + /// + /// Date à laquelle la participation a été créée + /// public DateTime DateCreation { get; set; } + + /// + /// Indique si le collaborateur a effectué l’évaluation de la formation + /// public bool EstEvaluee { get; set; } - public long DemandeFormationId { get; set; } + + /// + /// Id de la demande de formation + /// + public long IdDemandeFormation { get; set; } + + /// + /// Demande de formation qui est lié à la participation d’un collaborateur à une formation + /// public DemandeFormation DemandeFormation { get; set; } + + /// + /// Formation qui est lié à la participation d’un collaborateur à une formation + /// public Formation Formation { get; set; } + + /// + /// Liste des évaluations qui sont liées à la participation d’un collaborateur à une formation + /// public List Evaluation { get; set; } } } diff --git a/EPAServeur/Models/Formation/StatutFormation.cs b/EPAServeur/Models/Formation/StatutFormation.cs index baf377a..60684ae 100644 --- a/EPAServeur/Models/Formation/StatutFormation.cs +++ b/EPAServeur/Models/Formation/StatutFormation.cs @@ -5,10 +5,24 @@ using System.Threading.Tasks; namespace EPAServeur.Models.Formation { + /// + /// Statut d'une formation + /// public class StatutFormation { - public int Id { get; set; } + /// + /// Id du statut de la formation + /// + public int IdStatutFormation { get; set; } + + /// + /// Libellé du statut de la formation + /// public string Libelle { get; set; } + + /// + /// Formations qui sont liées au statut + /// public List Formations { get; set; } } } diff --git a/EPAServeur/Models/Formation/Theme.cs b/EPAServeur/Models/Formation/Theme.cs deleted file mode 100644 index 27a60fe..0000000 --- a/EPAServeur/Models/Formation/Theme.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace EPAServeur.Models.Formation -{ - public class Theme - { - public int Id { get; set; } - public string Libelle { get; set; } - } -} diff --git a/EPAServeur/Models/Formation/TypeFormation.cs b/EPAServeur/Models/Formation/TypeFormation.cs index 0164ee3..637a497 100644 --- a/EPAServeur/Models/Formation/TypeFormation.cs +++ b/EPAServeur/Models/Formation/TypeFormation.cs @@ -5,10 +5,24 @@ using System.Threading.Tasks; namespace EPAServeur.Models.Formation { + /// + /// Type d’une formation. + /// public class TypeFormation { - public int Id { get; set; } + /// + /// Id du type de la formation + /// + public int IdTypeFormation { get; set; } + + /// + /// Libellé du type de la formation + /// public string Libelle { get; set; } + + /// + /// Formations qui sont liées au type + /// public List Formations { get; set; } } } diff --git a/EPAServeur/Services/FormationService.cs b/EPAServeur/Services/FormationService.cs index 5040dc2..f3a51f8 100644 --- a/EPAServeur/Services/FormationService.cs +++ b/EPAServeur/Services/FormationService.cs @@ -45,7 +45,7 @@ namespace EPAServeur.Services .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) .Include(formation => formation.TypeFormation) - .FirstOrDefault(formation => formation.Id == idFormation); + .FirstOrDefault(formation => formation.IdFormation == idFormation); if (formation == null) throw new FormationNotFoundException(); @@ -64,7 +64,7 @@ namespace EPAServeur.Services .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) .Include(formation => formation.TypeFormation) - .FirstOrDefaultAsync(formation => formation.Id == idFormation); + .FirstOrDefaultAsync(formation => formation.IdFormation == idFormation); if (formation == null) throw new FormationNotFoundException(); @@ -102,7 +102,7 @@ namespace EPAServeur.Services .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) .Include(formation => formation.TypeFormation) - .Where(formation => formation.Statut.Id == statutFormation && formation.IdAgence == idAgence).Skip(skip).Take(take); + .Where(formation => formation.Statut.IdStatutFormation == statutFormation && formation.IdAgence == idAgence).Skip(skip).Take(take); } else if (statutFormation != null && idAgence == null) { @@ -111,7 +111,7 @@ namespace EPAServeur.Services .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) .Include(formation => formation.TypeFormation) - .Where(formation => formation.Statut.Id == statutFormation).Skip(skip).Take(take); + .Where(formation => formation.Statut.IdStatutFormation == statutFormation).Skip(skip).Take(take); } else if (idAgence != null) { @@ -164,7 +164,7 @@ namespace EPAServeur.Services .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) .Include(formation => formation.TypeFormation) - .Where(formation => formation.Statut.Id == statutFormation && formation.IdAgence == idAgence).Skip(skip).Take(take).ToListAsync(); + .Where(formation => formation.Statut.IdStatutFormation == statutFormation && formation.IdAgence == idAgence).Skip(skip).Take(take).ToListAsync(); } else if (statutFormation != null && idAgence == null) { @@ -173,7 +173,7 @@ namespace EPAServeur.Services .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) .Include(formation => formation.TypeFormation) - .Where(formation => formation.Statut.Id == statutFormation).Skip(skip).Take(take).ToListAsync(); + .Where(formation => formation.Statut.IdStatutFormation == statutFormation).Skip(skip).Take(take).ToListAsync(); } else if (idAgence != null) { @@ -224,13 +224,13 @@ namespace EPAServeur.Services int take = parPAge.Value; if (idAgence != null) - formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.Id == 4) + formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.IdStatutFormation == 4) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) .Include(formation => formation.TypeFormation).Skip(skip).Take(take); else - formations = epContext.Formation.Where(formation => formation.Statut.Id == 4) + formations = epContext.Formation.Where(formation => formation.Statut.IdStatutFormation == 4) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) @@ -265,13 +265,13 @@ namespace EPAServeur.Services int take = parPAge.Value; if (idAgence != null) - formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.Id == 4) + formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.IdStatutFormation == 4) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) .Include(formation => formation.TypeFormation).Skip(skip).Take(take).ToListAsync(); else - formations = await epContext.Formation.Where(formation => formation.Statut.Id == 4) + formations = await epContext.Formation.Where(formation => formation.Statut.IdStatutFormation == 4) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) @@ -308,7 +308,7 @@ namespace EPAServeur.Services if (idAgence != null) { - formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.Id == 3) + formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.IdStatutFormation == 3) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) @@ -318,7 +318,7 @@ namespace EPAServeur.Services else { - formations = epContext.Formation.Where(formation => formation.Statut.Id == 3) + formations = epContext.Formation.Where(formation => formation.Statut.IdStatutFormation == 3) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) @@ -357,7 +357,7 @@ namespace EPAServeur.Services if (idAgence != null) { - formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.Id == 3) + formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && formation.Statut.IdStatutFormation == 3) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) @@ -367,7 +367,7 @@ namespace EPAServeur.Services else { - formations = await epContext.Formation.Where(formation => formation.Statut.Id == 3) + formations = await epContext.Formation.Where(formation => formation.Statut.IdStatutFormation == 3) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) @@ -404,7 +404,7 @@ namespace EPAServeur.Services if (idAgence != null) { - formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && (formation.Statut.Id == 1 || formation.Statut.Id == 2)) + formations = epContext.Formation.Where(formation => formation.IdAgence == idAgence && (formation.Statut.IdStatutFormation == 1 || formation.Statut.IdStatutFormation == 2)) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) @@ -413,7 +413,7 @@ namespace EPAServeur.Services } else { - formations = epContext.Formation.Where(formation => (formation.Statut.Id == 1 || formation.Statut.Id == 2)) + formations = epContext.Formation.Where(formation => (formation.Statut.IdStatutFormation == 1 || formation.Statut.IdStatutFormation == 2)) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) @@ -450,7 +450,7 @@ namespace EPAServeur.Services if (idAgence != null) { - formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && (formation.Statut.Id == 1 || formation.Statut.Id == 2)) + formations = await epContext.Formation.Where(formation => formation.IdAgence == idAgence && (formation.Statut.IdStatutFormation == 1 || formation.Statut.IdStatutFormation == 2)) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) @@ -460,7 +460,7 @@ namespace EPAServeur.Services else { - formations = await epContext.Formation.Where(formation => (formation.Statut.Id == 1 || formation.Statut.Id == 2)) + formations = await epContext.Formation.Where(formation => (formation.Statut.IdStatutFormation == 1 || formation.Statut.IdStatutFormation == 2)) .Include(formation => formation.Statut) .Include(formation => formation.ModeFormation) .Include(formation => formation.Origine) @@ -758,10 +758,10 @@ namespace EPAServeur.Services || string.IsNullOrWhiteSpace(formation.Intitule) || string.IsNullOrWhiteSpace(formation.Organisme) || !formation.DateDebut.HasValue || !formation.DateFin.HasValue || formation.DateDebut.Value > formation.DateFin.Value || !formation.Statut.Id.HasValue || !formation.Mode.Id.HasValue || !formation.Origine.Id.HasValue || !formation.Type.Id.HasValue - || !epContext.StatutFormation.Any(statut => statut.Id == formation.Statut.Id.Value && statut.Libelle == formation.Statut.Libelle) - || !epContext.ModeFormation.Any(mode => mode.Id == formation.Mode.Id.Value && mode.Libelle == formation.Mode.Libelle) - || !epContext.OrigineFormation.Any(origine => origine.Id == formation.Origine.Id.Value && origine.Libelle == formation.Origine.Libelle) - || !epContext.TypeFormation.Any(type => type.Id == formation.Type.Id.Value && type.Libelle == formation.Type.Libelle)); + || !epContext.StatutFormation.Any(statut => statut.IdStatutFormation == formation.Statut.Id.Value && statut.Libelle == formation.Statut.Libelle) + || !epContext.ModeFormation.Any(mode => mode.IdModeFormation == formation.Mode.Id.Value && mode.Libelle == formation.Mode.Libelle) + || !epContext.OrigineFormation.Any(origine => origine.IdOrigineFormation == formation.Origine.Id.Value && origine.Libelle == formation.Origine.Libelle) + || !epContext.TypeFormation.Any(type => type.IdTypeFormation == formation.Type.Id.Value && type.Libelle == formation.Type.Libelle)); } /// @@ -777,10 +777,10 @@ namespace EPAServeur.Services || string.IsNullOrWhiteSpace(formation.Intitule) || string.IsNullOrWhiteSpace(formation.Organisme) || !formation.DateDebut.HasValue || !formation.DateFin.HasValue || formation.DateDebut.Value > formation.DateFin.Value || !formation.Statut.Id.HasValue || !formation.Mode.Id.HasValue || !formation.Origine.Id.HasValue || !formation.Type.Id.HasValue - || ! await epContext.StatutFormation.AnyAsync(statut => statut.Id == formation.Statut.Id.Value && statut.Libelle == formation.Statut.Libelle) - || ! await epContext.ModeFormation.AnyAsync(mode => mode.Id == formation.Mode.Id.Value && mode.Libelle == formation.Mode.Libelle) - || ! await epContext.OrigineFormation.AnyAsync(origine => origine.Id == formation.Origine.Id.Value && origine.Libelle == formation.Origine.Libelle) - || ! await epContext.TypeFormation.AnyAsync(type => type.Id == formation.Type.Id.Value && type.Libelle == formation.Type.Libelle)); + || ! await epContext.StatutFormation.AnyAsync(statut => statut.IdStatutFormation == formation.Statut.Id.Value && statut.Libelle == formation.Statut.Libelle) + || ! await epContext.ModeFormation.AnyAsync(mode => mode.IdModeFormation == formation.Mode.Id.Value && mode.Libelle == formation.Mode.Libelle) + || ! await epContext.OrigineFormation.AnyAsync(origine => origine.IdOrigineFormation == formation.Origine.Id.Value && origine.Libelle == formation.Origine.Libelle) + || ! await epContext.TypeFormation.AnyAsync(type => type.IdTypeFormation == formation.Type.Id.Value && type.Libelle == formation.Type.Libelle)); } #region Object to DTO /// @@ -792,7 +792,7 @@ namespace EPAServeur.Services { FormationDTO formationDTO = new FormationDTO() { - Id = formation.Id, + Id = formation.IdFormation, Intitule = formation.Intitule, IdAgence = formation.IdAgence, DateDebut = formation.DateDebut, @@ -821,7 +821,7 @@ namespace EPAServeur.Services return null; OrigineFormationDTO origineFormationDTO = new OrigineFormationDTO() { - Id = origineFormation.Id, + Id = origineFormation.IdOrigineFormation, Libelle = origineFormation.Libelle }; return origineFormationDTO; @@ -838,7 +838,7 @@ namespace EPAServeur.Services return null; StatutFormationDTO statutFormationDTO = new StatutFormationDTO() { - Id = statutFormation.Id, + Id = statutFormation.IdStatutFormation, Libelle = statutFormation.Libelle }; return statutFormationDTO; @@ -855,7 +855,7 @@ namespace EPAServeur.Services return null; ModeFormationDTO modeFormationDTO = new ModeFormationDTO() { - Id = modeFormation.Id, + Id = modeFormation.IdModeFormation, Libelle = modeFormation.Libelle }; return modeFormationDTO; @@ -871,7 +871,7 @@ namespace EPAServeur.Services return null; TypeFormationDTO typeFormationDTO = new TypeFormationDTO() { - Id = typeFormation.Id, + Id = typeFormation.IdTypeFormation, Libelle = typeFormation.Libelle }; return typeFormationDTO; @@ -914,7 +914,7 @@ namespace EPAServeur.Services { OrigineFormation origineFormation = new OrigineFormation() { - Id = origineFormationDTO.Id.Value, + IdOrigineFormation = origineFormationDTO.Id.Value, Libelle = origineFormationDTO.Libelle }; return origineFormation; @@ -929,7 +929,7 @@ namespace EPAServeur.Services { StatutFormation statutFormation = new StatutFormation() { - Id = statutFormationDTO.Id.Value, + IdStatutFormation = statutFormationDTO.Id.Value, Libelle = statutFormationDTO.Libelle }; return statutFormation; @@ -944,7 +944,7 @@ namespace EPAServeur.Services { ModeFormation modeFormation = new ModeFormation() { - Id = modeFormationDTO.Id.Value, + IdModeFormation = modeFormationDTO.Id.Value, Libelle = modeFormationDTO.Libelle }; return modeFormation; @@ -959,7 +959,7 @@ namespace EPAServeur.Services { TypeFormation typeFormation = new TypeFormation() { - Id = typeFormationDTO.Id.Value, + IdTypeFormation = typeFormationDTO.Id.Value, Libelle = typeFormationDTO.Libelle }; return typeFormation;