#211 : Optimisation de la recherche des dernières chroniques et des titres les plus populaires.
This commit is contained in:
@@ -181,4 +181,39 @@ public class LocalTitreRepository : ITitreRepository
|
||||
|
||||
return titre == null ? null : (titre.IdTitre, titre.Libelle);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<Titre> DerniereChronique(int offset, int limit)
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.dataStore.Titres
|
||||
.OrderByDescending(t => t.DateCreation)
|
||||
.Paginate(offset, limit);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.logger.LogError(ex, "Erreur lors de la recuperation des dernieres chroniques.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerable<Titre> TopTitre(int offset, int limit)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.logger.LogInformation("Récupération du Top Titre.");
|
||||
var titres = this.dataStore.Titres
|
||||
.OrderByDescending(t => t.NbLikes)
|
||||
.Paginate(offset, limit);
|
||||
|
||||
return titres;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.logger.LogError(ex, "Erreur lors de la récupération du Top Titre.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user