From 1338a073fd8a1ae067582cb44a1d095dd9bb6d5d Mon Sep 17 00:00:00 2001 From: "kentin.brongniart" Date: Sun, 6 Apr 2025 20:40:32 +0200 Subject: [PATCH] correction PaginationResult --- WF_EF_Api/ServicesApi/QuoteService.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/WF_EF_Api/ServicesApi/QuoteService.cs b/WF_EF_Api/ServicesApi/QuoteService.cs index 7538781..f5cc5f0 100644 --- a/WF_EF_Api/ServicesApi/QuoteService.cs +++ b/WF_EF_Api/ServicesApi/QuoteService.cs @@ -28,13 +28,13 @@ namespace ServicesApi public async Task> GetAllQuote() { var quotes = quoteService.GetAllQuote().Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), 0, quotes.Count(), quotes.ToDto()); } public async Task> GetAllQuoteLang(int index, int pageSize, int lang) { var quotes = quoteService.GetAllQuoteLang(index, pageSize,lang).Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), index, pageSize, quotes.ToDto()); } public async Task GetDailyQuote(DateOnly date, int lang) @@ -45,19 +45,19 @@ namespace ServicesApi public async Task> GetFavorites(int index, int pageSize, int UserId) { var quotes = quoteService.GetFavorites(index, pageSize, UserId).Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), index, pageSize, quotes.ToDto()); } public async Task> GetInvalidQuote(int index, int pageSize, int lang) { var quotes = quoteService.GetInvalidQuote(index, pageSize, lang).Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), index, pageSize, quotes.ToDto()); } public async Task> GetInvalidQuote(int index, int pageSize) { var quotes = quoteService.GetInvalidQuote(index, pageSize).Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), index, pageSize, quotes.ToDto()); } public async Task GetLastQuoteId() @@ -75,19 +75,19 @@ namespace ServicesApi public async Task> GetSomeQuote(int index, int pageSize) { var quotes = quoteService.GetSomeQuote(index, pageSize).Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), index, pageSize, quotes.ToDto()); } public async Task> GetSuggestions(int index, int pageSize, int lang) { var quotes = quoteService.GetSuggestions(index, pageSize, lang).Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), index, pageSize, quotes.ToDto()); } public async Task> GetValidQuote(int index, int pageSize) { var quotes = quoteService.GetValidQuote(index, pageSize).Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), index, pageSize, quotes.ToDto()); } public async Task RemoveQuote(int quoteId) @@ -98,19 +98,19 @@ namespace ServicesApi public async Task> SearchByCharacter(string character, int index, int pageSize, int lang) { var quotes = quoteService.SearchByCharacter(character, index, pageSize, lang).Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), index, pageSize, quotes.ToDto()); } public async Task> SearchByContent(string content, int index, int pageSize, int lang) { var quotes = quoteService.SearchByContent(content, index, pageSize, lang).Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), index, pageSize, quotes.ToDto()); } public async Task> SearchBySource(string source, int index, int pageSize, int lang) { var quotes = quoteService.SearchBySource(source, index, pageSize, lang).Result.items; - return new PaginationResult(quotes.Count(), 0, 10, quotes.ToDto()); + return new PaginationResult(quotes.Count(), index, pageSize, quotes.ToDto()); } public async Task UpdateQuote(int quoteId, QuoteDTO quote)