diff --git a/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceLocal.cs b/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceLocal.cs
index 4271681..0afa4ab 100644
--- a/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceLocal.cs
+++ b/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceLocal.cs
@@ -1,198 +1,198 @@
-using WF_WebAdmin.Converter;
-using WF_WebAdmin.Model;
-using Npgsql;
-
-namespace WF_WebAdmin.Service
-{
- public class QuoteServiceLocal: IQuoteService
- {
- private readonly string? _connectionString = "Host=localhost;Port=5432;Username=loguichard3;Password=Reglisse15.;Database=dbloguichard3";
-
-
-
- ///
- /// Asynchronously adds a new quote to the database and returns the corresponding .
- ///
- /// The object to be added to the database.
- /// A task representing the asynchronous operation, with a result containing the added quote's data.
- ///
- /// This method converts the provided object into a using .
- /// It then inserts the quote into the PostgreSQL database using a parameterized SQL query with the help of Npgsql.
- /// After successfully inserting the quote, the corresponding is returned to the caller.
- /// Error handling is in place to catch any issues during the database insertion process, with the exception message logged in case of failure.
- ///
- public async Task AddQuoteAsync(Quote quote)
- {
- QuoteExtension extension = new QuoteExtension();
- QuoteDTO quoteDTO = extension.QuoteToDTO(quote);
-
- // Utilisation de NpgsqlConnection pour PostgreSQL
- using (var connection = new NpgsqlConnection(_connectionString))
- {
- // Définir la requête SQL d'insertion
- var commandText = "INSERT INTO Quote (content, langue, reason, id_source, id_caracter, id_user_verif, img_path) " +
- "VALUES (@content, @langue, @reason, @source, @character, @user, @img_path)";
-
- // Créer une commande Npgsql
- var command = new NpgsqlCommand(commandText, connection);
-
-
- /*
- // Ajouter des paramètres à la commande
- command.Parameters.AddWithValue("@content", quote.Content);
- command.Parameters.AddWithValue("@langue", quote.Langue);
- command.Parameters.AddWithValue("@reason", "À vérifier"); // Vous pouvez changer ça si nécessaire
- command.Parameters.AddWithValue("@source", quote.Source);
- command.Parameters.AddWithValue("@character", quote.Character);
- command.Parameters.AddWithValue("@user", quote.User); // Assurez-vous que `quote.User` est correctement défini
- command.Parameters.AddWithValue("@img_path", quote.ImgPath);
- */
-
-
- try
- {
- // Ouvrir la connexion à la base de données
- await connection.OpenAsync();
-
- // Exécuter la commande d'insertion
- await command.ExecuteNonQueryAsync();
- }
- catch (Exception ex)
- {
- // Gérer les erreurs ici (par exemple, afficher ou enregistrer les erreurs)
- Console.WriteLine($"Une erreur est survenue lors de l'ajout de la citation : {ex.Message}");
- }
- finally
- {
- // Fermer la connexion (automatiquement géré avec `using`, mais ajouté pour explicitement montrer le processus)
- await connection.CloseAsync();
- }
- }
-
- // Retourner l'objet DTO pour que vous puissiez l'utiliser ailleurs dans votre application
- return quoteDTO;
- }
-
-
- ///
- /// Asynchronously handles the removal of a quote and returns the corresponding .
- ///
- /// The object to be removed.
- /// A task representing the asynchronous operation, with a result corresponding to the removed quote.
- ///
- /// This method takes a object, converts it into a using the
- /// , and then returns the DTO. Note that while this function is named `RemoveQuote`,
- /// it currently only converts the quote to a DTO and does not actually perform any database removal operation.
- /// You may need to implement additional logic to remove the quote from the database.
- ///
- public Task RemoveQuote(Quote quote)
- {
- QuoteExtension extension = new QuoteExtension();
- QuoteDTO quoteDTO = extension.QuoteToDTO(quote);
-
- // Return the DTO as the result of this asynchronous operation (though no removal logic is currently implemented)
- return Task.FromResult(quoteDTO);
- }
-
-
- ///
- /// Asynchronously validates a quote and returns the corresponding .
- ///
- /// The object to be validated.
- /// A task representing the asynchronous operation, with a result corresponding to the validated quote.
- ///
- /// This method takes a object, converts it into a using the
- /// , and returns the DTO. The method is named `validQuote`, but currently, it only
- /// converts the quote into a DTO and does not perform any actual validation logic.
- /// If you intend to validate the quote (e.g., updating its status in a database), you will need to implement
- /// the actual validation logic separately.
- ///
- public Task validQuote(Quote quote)
- {
- QuoteExtension extension = new QuoteExtension();
- QuoteDTO quoteDTO = extension.QuoteToDTO(quote);
-
- // Return the DTO as the result of this asynchronous operation (though no validation logic is currently implemented)
- return Task.FromResult(quoteDTO);
- }
-
-
- ///
- /// Asynchronously updates a quote and returns the corresponding .
- ///
- /// The object to be updated.
- /// A task representing the asynchronous operation, with a result corresponding to the updated quote.
- ///
- /// This method takes a object, converts it into a using the
- /// , and returns the DTO. The method is named `updateQuote`, but currently, it only
- /// converts the quote into a DTO and does not perform any actual update logic.
- /// If you intend to update the quote (e.g., modifying the quote in a database or data source),
- /// you will need to implement the actual update logic separately.
- ///
- public Task updateQuote(Quote quote)
- {
- QuoteExtension extension = new QuoteExtension();
- QuoteDTO quoteDTO = extension.QuoteToDTO(quote);
-
- // Return the DTO as the result of this asynchronous operation (though no update logic is currently implemented)
- return Task.FromResult(quoteDTO);
- }
-
-
-
- public Task addQuote(Quote quote)
- {
- throw new NotImplementedException();
- }
-
- public Task removeQuote(Quote quote)
- {
- throw new NotImplementedException();
- }
-
- public Task> getAllQuote()
- {
- throw new NotImplementedException();
- }
-
- public Task> getSomeQuote(int nb, int page)
- {
- throw new NotImplementedException();
- }
-
- public Task> reserchQuote(string reserch, List argument)
- {
- throw new NotImplementedException();
- }
-
- public Task> getAllQuoteInvalid()
- {
- throw new NotImplementedException();
- }
-
- public Task> getSomeQuoteInvalid(int nb, int page)
- {
- throw new NotImplementedException();
- }
-
- public Task getOnequote(int id)
- {
- throw new NotImplementedException();
- }
-
- public Task getNbQuote()
- {
- throw new NotImplementedException();
- }
-
- public Task> getChar()
- {
- throw new NotImplementedException();
- }
-
- public Task> getSrc()
- {
- throw new NotImplementedException();
- }
- }
-}
+using WF_WebAdmin.Converter;
+using WF_WebAdmin.Model;
+using Npgsql;
+
+namespace WF_WebAdmin.Service
+{
+ public class QuoteServiceLocal: IQuoteService
+ {
+ private readonly string? _connectionString = "Host=localhost;Port=5432;Username=;Password=;Database=";
+
+
+
+ ///
+ /// Asynchronously adds a new quote to the database and returns the corresponding .
+ ///
+ /// The object to be added to the database.
+ /// A task representing the asynchronous operation, with a result containing the added quote's data.
+ ///
+ /// This method converts the provided object into a using .
+ /// It then inserts the quote into the PostgreSQL database using a parameterized SQL query with the help of Npgsql.
+ /// After successfully inserting the quote, the corresponding is returned to the caller.
+ /// Error handling is in place to catch any issues during the database insertion process, with the exception message logged in case of failure.
+ ///
+ public async Task AddQuoteAsync(Quote quote)
+ {
+ QuoteExtension extension = new QuoteExtension();
+ QuoteDTO quoteDTO = extension.QuoteToDTO(quote);
+
+ // Utilisation de NpgsqlConnection pour PostgreSQL
+ using (var connection = new NpgsqlConnection(_connectionString))
+ {
+ // Définir la requête SQL d'insertion
+ var commandText = "INSERT INTO Quote (content, langue, reason, id_source, id_caracter, id_user_verif, img_path) " +
+ "VALUES (@content, @langue, @reason, @source, @character, @user, @img_path)";
+
+ // Créer une commande Npgsql
+ var command = new NpgsqlCommand(commandText, connection);
+
+
+ /*
+ // Ajouter des paramètres à la commande
+ command.Parameters.AddWithValue("@content", quote.Content);
+ command.Parameters.AddWithValue("@langue", quote.Langue);
+ command.Parameters.AddWithValue("@reason", "À vérifier"); // Vous pouvez changer ça si nécessaire
+ command.Parameters.AddWithValue("@source", quote.Source);
+ command.Parameters.AddWithValue("@character", quote.Character);
+ command.Parameters.AddWithValue("@user", quote.User); // Assurez-vous que `quote.User` est correctement défini
+ command.Parameters.AddWithValue("@img_path", quote.ImgPath);
+ */
+
+
+ try
+ {
+ // Ouvrir la connexion à la base de données
+ await connection.OpenAsync();
+
+ // Exécuter la commande d'insertion
+ await command.ExecuteNonQueryAsync();
+ }
+ catch (Exception ex)
+ {
+ // Gérer les erreurs ici (par exemple, afficher ou enregistrer les erreurs)
+ Console.WriteLine($"Une erreur est survenue lors de l'ajout de la citation : {ex.Message}");
+ }
+ finally
+ {
+ // Fermer la connexion (automatiquement géré avec `using`, mais ajouté pour explicitement montrer le processus)
+ await connection.CloseAsync();
+ }
+ }
+
+ // Retourner l'objet DTO pour que vous puissiez l'utiliser ailleurs dans votre application
+ return quoteDTO;
+ }
+
+
+ ///
+ /// Asynchronously handles the removal of a quote and returns the corresponding .
+ ///
+ /// The object to be removed.
+ /// A task representing the asynchronous operation, with a result corresponding to the removed quote.
+ ///
+ /// This method takes a object, converts it into a using the
+ /// , and then returns the DTO. Note that while this function is named `RemoveQuote`,
+ /// it currently only converts the quote to a DTO and does not actually perform any database removal operation.
+ /// You may need to implement additional logic to remove the quote from the database.
+ ///
+ public Task RemoveQuote(Quote quote)
+ {
+ QuoteExtension extension = new QuoteExtension();
+ QuoteDTO quoteDTO = extension.QuoteToDTO(quote);
+
+ // Return the DTO as the result of this asynchronous operation (though no removal logic is currently implemented)
+ return Task.FromResult(quoteDTO);
+ }
+
+
+ ///
+ /// Asynchronously validates a quote and returns the corresponding .
+ ///
+ /// The object to be validated.
+ /// A task representing the asynchronous operation, with a result corresponding to the validated quote.
+ ///
+ /// This method takes a object, converts it into a using the
+ /// , and returns the DTO. The method is named `validQuote`, but currently, it only
+ /// converts the quote into a DTO and does not perform any actual validation logic.
+ /// If you intend to validate the quote (e.g., updating its status in a database), you will need to implement
+ /// the actual validation logic separately.
+ ///
+ public Task validQuote(Quote quote)
+ {
+ QuoteExtension extension = new QuoteExtension();
+ QuoteDTO quoteDTO = extension.QuoteToDTO(quote);
+
+ // Return the DTO as the result of this asynchronous operation (though no validation logic is currently implemented)
+ return Task.FromResult(quoteDTO);
+ }
+
+
+ ///
+ /// Asynchronously updates a quote and returns the corresponding .
+ ///
+ /// The object to be updated.
+ /// A task representing the asynchronous operation, with a result corresponding to the updated quote.
+ ///
+ /// This method takes a object, converts it into a using the
+ /// , and returns the DTO. The method is named `updateQuote`, but currently, it only
+ /// converts the quote into a DTO and does not perform any actual update logic.
+ /// If you intend to update the quote (e.g., modifying the quote in a database or data source),
+ /// you will need to implement the actual update logic separately.
+ ///
+ public Task updateQuote(Quote quote)
+ {
+ QuoteExtension extension = new QuoteExtension();
+ QuoteDTO quoteDTO = extension.QuoteToDTO(quote);
+
+ // Return the DTO as the result of this asynchronous operation (though no update logic is currently implemented)
+ return Task.FromResult(quoteDTO);
+ }
+
+
+
+ public Task addQuote(Quote quote)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task removeQuote(Quote quote)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task> getAllQuote()
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task> getSomeQuote(int nb, int page)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task> reserchQuote(string reserch, List argument)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task> getAllQuoteInvalid()
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task> getSomeQuoteInvalid(int nb, int page)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task getOnequote(int id)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task getNbQuote()
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task> getChar()
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task> getSrc()
+ {
+ throw new NotImplementedException();
+ }
+ }
+}