Ajout de la pagination

develop
jboinembalome 4 years ago
parent 051b2fb731
commit ebc246b31d
  1. 24
      Services/EngagementService.cs
  2. 40
      Services/FormationService.cs

@ -54,9 +54,9 @@ namespace EPAServeur.Services
int take = parPAge.Value; int take = parPAge.Value;
if (idAgence != null) if (idAgence != null)
engagements = epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence); engagements = epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence).Skip(skip).Take(take);
else else
engagements = epContext.Engagement.Include(engagement => engagement.Ep); engagements = epContext.Engagement.Include(engagement => engagement.Ep).Skip(skip).Take(take);
if (engagements == null || engagements.Count() == 0) if (engagements == null || engagements.Count() == 0)
return new List<EngagementDTO>(); return new List<EngagementDTO>();
@ -79,9 +79,9 @@ namespace EPAServeur.Services
int take = parPAge.Value; int take = parPAge.Value;
if (idAgence != null) if (idAgence != null)
engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence).ToListAsync(); engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence).Skip(skip).Take(take).ToListAsync();
else else
engagements = await epContext.Engagement.Include(engagement => engagement.Ep).ToListAsync(); engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Skip(skip).Take(take).ToListAsync();
if (engagements == null || engagements.Count() == 0) if (engagements == null || engagements.Count() == 0)
return new List<EngagementDTO>(); return new List<EngagementDTO>();
@ -105,9 +105,9 @@ namespace EPAServeur.Services
int take = parPAge.Value; int take = parPAge.Value;
if (idAgence != null) if (idAgence != null)
engagements = epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence && engagement.Realise == null).ToList(); engagements = epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence && engagement.Realise == null).Skip(skip).Take(take).ToList();
else else
engagements = epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Realise == null).ToList(); engagements = epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Realise == null).Skip(skip).Take(take).ToList();
if (engagements == null || engagements.Count() == 0) if (engagements == null || engagements.Count() == 0)
return new List<EngagementDTO>(); return new List<EngagementDTO>();
@ -130,9 +130,9 @@ namespace EPAServeur.Services
int take = parPAge.Value; int take = parPAge.Value;
if (idAgence != null) if (idAgence != null)
engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence && engagement.Realise == null).ToListAsync(); engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence && engagement.Realise == null).Skip(skip).Take(take).ToListAsync();
else else
engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Realise == null).ToListAsync(); engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Realise == null).Skip(skip).Take(take).ToListAsync();
if (engagements == null || engagements.Count() == 0) if (engagements == null || engagements.Count() == 0)
return new List<EngagementDTO>(); return new List<EngagementDTO>();
@ -156,9 +156,9 @@ namespace EPAServeur.Services
int take = parPAge.Value; int take = parPAge.Value;
if (idAgence != null) if (idAgence != null)
engagements = epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence && engagement.Modalite.ToLower().Contains(texte)); engagements = epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence && engagement.Modalite.ToLower().Contains(texte)).Skip(skip).Take(take);
else else
engagements = epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Realise != null && engagement.Modalite.ToLower().Contains(texte)); engagements = epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Realise != null && engagement.Modalite.ToLower().Contains(texte)).Skip(skip).Take(take);
if (engagements == null || engagements.Count() == 0) if (engagements == null || engagements.Count() == 0)
return new List<EngagementDTO>(); return new List<EngagementDTO>();
@ -181,9 +181,9 @@ namespace EPAServeur.Services
int take = parPAge.Value; int take = parPAge.Value;
if (idAgence != null) if (idAgence != null)
engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence && engagement.Modalite.ToLower().Contains(texte)).ToListAsync(); engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Ep.IdAgence == idAgence && engagement.Modalite.ToLower().Contains(texte)).Skip(skip).Take(take).ToListAsync();
else else
engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Realise != null && engagement.Modalite.ToLower().Contains(texte)).ToListAsync(); engagements = await epContext.Engagement.Include(engagement => engagement.Ep).Where(engagement => engagement.Realise != null && engagement.Modalite.ToLower().Contains(texte)).Skip(skip).Take(take).ToListAsync();
if (engagements == null || engagements.Count() == 0) if (engagements == null || engagements.Count() == 0)
return new List<EngagementDTO>(); return new List<EngagementDTO>();

@ -102,7 +102,7 @@ namespace EPAServeur.Services
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation) .Include(formation => formation.TypeFormation)
.Where(formation => formation.Statut.Id == statutFormation && formation.IdAgence == idAgence); .Where(formation => formation.Statut.Id == statutFormation && formation.IdAgence == idAgence).Skip(skip).Take(take);
} }
else if (statutFormation != null && idAgence == null) else if (statutFormation != null && idAgence == null)
{ {
@ -111,7 +111,7 @@ namespace EPAServeur.Services
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation) .Include(formation => formation.TypeFormation)
.Where(formation => formation.Statut.Id == statutFormation); .Where(formation => formation.Statut.Id == statutFormation).Skip(skip).Take(take);
} }
else if (idAgence != null) else if (idAgence != null)
{ {
@ -119,14 +119,14 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation); .Include(formation => formation.TypeFormation).Skip(skip).Take(take);
} }
else else
{ {
formations = epContext.Formation.Include(formation => formation.Statut) formations = epContext.Formation.Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation); .Include(formation => formation.TypeFormation).Skip(skip).Take(take);
} }
@ -168,7 +168,7 @@ namespace EPAServeur.Services
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation) .Include(formation => formation.TypeFormation)
.Where(formation => formation.Statut.Id == statutFormation && formation.IdAgence == idAgence).ToListAsync(); .Where(formation => formation.Statut.Id == statutFormation && formation.IdAgence == idAgence).Skip(skip).Take(take).ToListAsync();
} }
else if (statutFormation != null && idAgence == null) else if (statutFormation != null && idAgence == null)
{ {
@ -177,7 +177,7 @@ namespace EPAServeur.Services
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation) .Include(formation => formation.TypeFormation)
.Where(formation => formation.Statut.Id == statutFormation).ToListAsync(); .Where(formation => formation.Statut.Id == statutFormation).Skip(skip).Take(take).ToListAsync();
} }
else if (idAgence != null) else if (idAgence != null)
{ {
@ -186,7 +186,7 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation).Where(formation => formation.IdAgence == idAgence).ToListAsync(); .Include(formation => formation.TypeFormation).Where(formation => formation.IdAgence == idAgence).Skip(skip).Take(take).ToListAsync();
} }
else else
@ -195,7 +195,7 @@ namespace EPAServeur.Services
formations = await epContext.Formation.Include(formation => formation.Statut) formations = await epContext.Formation.Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation).ToListAsync(); .Include(formation => formation.TypeFormation).Skip(skip).Take(take).ToListAsync();
} }
@ -236,13 +236,13 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation); .Include(formation => formation.TypeFormation).Skip(skip).Take(take);
else else
formations = epContext.Formation.Where(formation => formation.Statut.Id == 4) formations = epContext.Formation.Where(formation => formation.Statut.Id == 4)
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation); .Include(formation => formation.TypeFormation).Skip(skip).Take(take);
if (formations == null) if (formations == null)
return null; return null;
@ -280,13 +280,13 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation).ToListAsync(); .Include(formation => formation.TypeFormation).Skip(skip).Take(take).ToListAsync();
else else
formations = await epContext.Formation.Where(formation => formation.Statut.Id == 4) formations = await epContext.Formation.Where(formation => formation.Statut.Id == 4)
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation).ToListAsync(); .Include(formation => formation.TypeFormation).Skip(skip).Take(take).ToListAsync();
if (formations == null) if (formations == null)
return null; return null;
@ -326,7 +326,7 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation); .Include(formation => formation.TypeFormation).Skip(skip).Take(take);
} }
else else
@ -336,7 +336,7 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation); .Include(formation => formation.TypeFormation).Skip(skip).Take(take);
} }
@ -379,7 +379,7 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation).ToListAsync(); .Include(formation => formation.TypeFormation).Skip(skip).Take(take).ToListAsync();
} }
else else
@ -389,7 +389,7 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation).ToListAsync(); .Include(formation => formation.TypeFormation).Skip(skip).Take(take).ToListAsync();
} }
@ -430,7 +430,7 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation); .Include(formation => formation.TypeFormation).Skip(skip).Take(take);
} }
else else
@ -439,7 +439,7 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation); .Include(formation => formation.TypeFormation).Skip(skip).Take(take);
} }
if (formations == null) if (formations == null)
@ -479,7 +479,7 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation).ToListAsync(); .Include(formation => formation.TypeFormation).Skip(skip).Take(take).ToListAsync();
} }
@ -489,7 +489,7 @@ namespace EPAServeur.Services
.Include(formation => formation.Statut) .Include(formation => formation.Statut)
.Include(formation => formation.ModeFormation) .Include(formation => formation.ModeFormation)
.Include(formation => formation.Origine) .Include(formation => formation.Origine)
.Include(formation => formation.TypeFormation).ToListAsync(); .Include(formation => formation.TypeFormation).Skip(skip).Take(take).ToListAsync();
} }
if (formations == null) if (formations == null)

Loading…
Cancel
Save