diff --git a/WF-WebAdmin/WF-WebAdmin/Converter/QuoteDTO.cs b/WF-WebAdmin/WF-WebAdmin/Converter/QuoteDTO.cs index f8b0fea..092db9d 100644 --- a/WF-WebAdmin/WF-WebAdmin/Converter/QuoteDTO.cs +++ b/WF-WebAdmin/WF-WebAdmin/Converter/QuoteDTO.cs @@ -9,23 +9,35 @@ namespace WF_WebAdmin.Converter public string Content { get; set; } public int Likes { get; set; } public string Langue { get; set; } - public bool IsValide { get; set; } + public bool? IsValide { get; set; } public string? Reason { get; set; } - public int IdCaracter { get; set; } - public int IdSource { get; set; } + public int? IdCaracter { get; set; } + public string NameCharac { get; set; } + public int? IdSource { get; set; } + public string TitleSrc { get; set; } + public DateTime DateSrc { get; set; } public int? IdUserVerif { get; set; } + public string NameUser { get; set; } + public int? IdImg { get; set; } + public string ImgPath { get; set; } - public QuoteDTO(int id_quote, string content, int likes, string langue, bool isValide, string? reason, int id_caracter, int id_source, int? id_user_verif) + public QuoteDTO(int id_quote,string content,int likes,string langue,bool? isValide,string? reason,int? id_caracter,string name_charac,int? id_source,string title,DateTime date,int? id_user_verif,string name_user ,int? id_img,string img_path) { this.Id = id_quote; - this.Content = content; + this.Content = content; this.Likes = likes; this.Langue = langue; this.IsValide = isValide; - this.Reason = reason; - this.IdCaracter = id_caracter; - this.IdSource = id_source; - this.IdUserVerif = id_user_verif; - } + this.Reason = reason; + this.IdCaracter = id_caracter; + this.NameCharac = name_charac; + this.IdSource = id_source; + this.TitleSrc = title; + this.DateSrc = date; + this.IdUserVerif = id_user_verif; + this.NameUser = name_user; + this.IdImg = id_img; + this.ImgPath =img_path; + } } } diff --git a/WF-WebAdmin/WF-WebAdmin/Converter/QuoteExtension.cs b/WF-WebAdmin/WF-WebAdmin/Converter/QuoteExtension.cs index 0f3b187..088520a 100644 --- a/WF-WebAdmin/WF-WebAdmin/Converter/QuoteExtension.cs +++ b/WF-WebAdmin/WF-WebAdmin/Converter/QuoteExtension.cs @@ -6,13 +6,13 @@ namespace WF_WebAdmin.Converter { public QuoteDTO QuoteToDTO(Quote q) { - QuoteDTO quote = new QuoteDTO(q.Id, q.Content, q.Likes, q.Langue, q.IsValide, q.Reason, q.IdCaracter, q.IdSource, q.IdUserVerif); + QuoteDTO quote = new QuoteDTO(q.Id, q.Content, q.Like, q.Langue, null,null, null,q.Charac,null,q.TitleSrc,q.DateSrc,null,q.UserProposition,null,q.ImgPath); return quote; } public Quote DTOToQuote(QuoteDTO q) { - Quote quote = new Quote(q.Id, q.Content, q.Likes, q.Langue, q.IsValide, q.Reason, q.IdCaracter, q.IdSource, q.IdUserVerif); + Quote quote = new Quote(q.Id, q.Content,q.NameCharac,q.ImgPath,q.TitleSrc,q.DateSrc,q.Likes,q.Langue,q.NameUser); return quote; } } diff --git a/WF-WebAdmin/WF-WebAdmin/Model/Quote.cs b/WF-WebAdmin/WF-WebAdmin/Model/Quote.cs index c640723..5a56083 100644 --- a/WF-WebAdmin/WF-WebAdmin/Model/Quote.cs +++ b/WF-WebAdmin/WF-WebAdmin/Model/Quote.cs @@ -1,7 +1,32 @@ -namespace WF_WebAdmin.Model +using Microsoft.AspNetCore.DataProtection.KeyManagement; + +namespace WF_WebAdmin.Model { public class Quote { + public int Id { get; set; } + public string Content { get; set; } + public int Like { get; set; } + public string Langue { get; set; } + public string Charac { get; set; } + public string ImgPath { get; set; } + public string TitleSrc { get; set; } + public DateTime DateSrc { get; set; } + public string UserProposition { get; set; } + + public Quote(int id, string content, string charac, string imgPath, string titleSrc, DateTime dateSrc, int like, string langue, string userProposition) + { + Id = id; + Content = content; + Charac = charac; + ImgPath = imgPath; + TitleSrc = titleSrc; + DateSrc = dateSrc; + Like = like; + Langue = langue; + UserProposition = userProposition; + } + /* public int Id { get; set; } public string Content { get; set; } public int Likes { get; set; } @@ -37,5 +62,6 @@ IdSource = idSource; IdUserVerif = idUserVerif; } + */ } } diff --git a/WF-WebAdmin/WF-WebAdmin/Model/User.cs b/WF-WebAdmin/WF-WebAdmin/Model/User.cs index 6d74ac9..7598733 100644 --- a/WF-WebAdmin/WF-WebAdmin/Model/User.cs +++ b/WF-WebAdmin/WF-WebAdmin/Model/User.cs @@ -3,7 +3,6 @@ public class User { public int Id { get; set; } - public string Image { get; set; } public string Name { get; set; } public string Email { get; set; } diff --git a/WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.razor.cs b/WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.razor.cs index 070ee4e..95b04d5 100644 --- a/WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.razor.cs +++ b/WF-WebAdmin/WF-WebAdmin/Pages/ValidQuote.razor.cs @@ -10,7 +10,18 @@ using System.Linq; namespace WF_WebAdmin.Pages { public partial class ValidQuote - { - + { + private Quote[] quotes; + + [Inject] + public HttpClient Http { get; set; } + + [Inject] + public NavigationManager NavigationManager { get; set; } + + protected override async Task OnInitializedAsync() + { + quotes = await Http.GetFromJsonAsync($"{NavigationManager.BaseUri}fake-dataQuote.json"); + } } } diff --git a/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceLocal.cs b/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceLocal.cs index 433e5d4..600c0d1 100644 --- a/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceLocal.cs +++ b/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceLocal.cs @@ -26,6 +26,8 @@ namespace WF_WebAdmin.Service // 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); @@ -34,6 +36,8 @@ namespace WF_WebAdmin.Service 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 { @@ -58,7 +62,7 @@ namespace WF_WebAdmin.Service // Retourner l'objet DTO pour que vous puissiez l'utiliser ailleurs dans votre application return quoteDTO; } - } + public Task RemoveQuote(Quote quote) { @@ -84,36 +88,49 @@ namespace WF_WebAdmin.Service 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> getOnequote(int id) { - + 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(); } - - } } diff --git a/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceStub.cs b/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceStub.cs index c603989..5989b12 100644 --- a/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceStub.cs +++ b/WF-WebAdmin/WF-WebAdmin/Service/QuoteServiceStub.cs @@ -10,7 +10,60 @@ namespace WF_WebAdmin.Service public HttpClient Http { get; set; } [Inject] - public NavigationManager NavigationManager { get; set; } - - + public NavigationManager NavigationManager { get; set; } + + + + + + public Task addQuote(Quote quote) + { + throw new NotImplementedException(); + } + + public Task> getAllQuote() + { + throw new NotImplementedException(); + } + + public Task> getAllQuoteInvalid() + { + throw new NotImplementedException(); + } + + public Task> getOnequote(int id) + { + throw new NotImplementedException(); + } + + public Task> getSomeQuote(int nb, int page) + { + throw new NotImplementedException(); + } + + public Task> getSomeQuoteInvalid(int nb, int page) + { + throw new NotImplementedException(); + } + + public Task removeQuote(Quote quote) + { + throw new NotImplementedException(); + } + + public Task> reserchQuote(string reserch, List argument) + { + throw new NotImplementedException(); + } + + public Task updateQuote(Quote quote) + { + throw new NotImplementedException(); + } + + public Task validQuote(Quote quote) + { + throw new NotImplementedException(); + } + } }