Debut correction bug

pull/22/head
kentin.brongniart 3 months ago
parent 54ab34216a
commit c5c2e597ae

@ -9,13 +9,19 @@ 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;
@ -24,8 +30,14 @@ namespace WF_WebAdmin.Converter
this.IsValide = isValide;
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;
}
}
}

@ -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;
}
}

@ -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;
}
*/
}
}

@ -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; }

@ -11,6 +11,17 @@ 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<Quote[]>($"{NavigationManager.BaseUri}fake-dataQuote.json");
}
}
}

@ -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<List<Quote>> getAllQuote()
public Task addQuote(Quote quote)
{
throw new NotImplementedException();
}
public Task removeQuote(Quote quote)
{
throw new NotImplementedException();
}
public Task<List<Quote>> getSomeQuote(int nb, int page)
public Task<List<Quote>> getAllQuote()
{
throw new NotImplementedException();
}
public Task<List<Quote>> getSomeQuote(int nb, int page)
{
throw new NotImplementedException();
}
public Task<List<Quote>> getOnequote(int id)
{
throw new NotImplementedException();
}
public Task<List<Quote>> reserchQuote(string reserch, List<string> argument)
{
throw new NotImplementedException();
}
public Task<List<Quote>> getAllQuoteInvalid()
{
throw new NotImplementedException();
}
public Task<List<Quote>> getSomeQuoteInvalid(int nb, int page)
{
throw new NotImplementedException();
}
}
}

@ -13,4 +13,57 @@ namespace WF_WebAdmin.Service
public NavigationManager NavigationManager { get; set; }
public Task addQuote(Quote quote)
{
throw new NotImplementedException();
}
public Task<List<Quote>> getAllQuote()
{
throw new NotImplementedException();
}
public Task<List<Quote>> getAllQuoteInvalid()
{
throw new NotImplementedException();
}
public Task<List<Quote>> getOnequote(int id)
{
throw new NotImplementedException();
}
public Task<List<Quote>> getSomeQuote(int nb, int page)
{
throw new NotImplementedException();
}
public Task<List<Quote>> getSomeQuoteInvalid(int nb, int page)
{
throw new NotImplementedException();
}
public Task removeQuote(Quote quote)
{
throw new NotImplementedException();
}
public Task<List<Quote>> reserchQuote(string reserch, List<string> argument)
{
throw new NotImplementedException();
}
public Task updateQuote(Quote quote)
{
throw new NotImplementedException();
}
public Task validQuote(Quote quote)
{
throw new NotImplementedException();
}
}
}

Loading…
Cancel
Save