DTO user et Quote terminé avec extensions

Converter
Maxime ROCHER 4 months ago
parent ee0a976ee2
commit 4fdfc87290

@ -1,7 +0,0 @@
namespace WF_WebAdmin.Converter
{
public class AdminDTO
{
}
}

@ -1,6 +0,0 @@
namespace WF_WebAdmin.Converter
{
public class AdminExtension
{
}
}

@ -18,42 +18,14 @@ namespace WF_WebAdmin.Converter
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)
{
this.Id = id_quote;
}
public int getId_quote()
{
return id_quote;
}
public string getContent() {
return content;
}
public int getLikes()
{
return likes;
}
public string getLangue()
{
return langue;
}
public bool getIsValide()
{
return isValide;
}
public string? getReason()
{
return reason;
}
public int getIdCaracter()
{
return id_caracter;
}
public int getIdSource()
{
return id_source;
}
public int? getIdUserVerif()
{
return id_user_verif;
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;
}
}
}

@ -12,7 +12,7 @@ namespace WF_WebAdmin.Converter
public Quote DTOToQuote(QuoteDTO q)
{
Quote quote = new Quote();
Quote quote = new Quote(q.Id, q.Content, q.Likes, q.Langue, q.IsValide, q.Reason, q.IdCaracter, q.IdSource, q.IdUserVerif);
return quote;
}
}

@ -0,0 +1,20 @@
namespace WF_WebAdmin.Converter
{
public class UserDTO
{
public int Id { get; set; }
public string Image { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public DateTime DateCreation { get; set; }
public UserDTO(int id, string image, string name, string email, DateTime dateCreation)
{
this.Id = id;
this.Image = image;
this.Name = name;
this.Email = email;
this.DateCreation = dateCreation;
}
}
}

@ -0,0 +1,19 @@
using WF_WebAdmin.Model;
namespace WF_WebAdmin.Converter
{
public class UserExtension
{
public User UserToDTO(UserDTO u)
{
User user = new User(u.Id, u.Image, u.Name, u.Email, u.DateCreation);
return user;
}
public UserDTO DTOToUser(User u)
{
UserDTO user = new UserDTO(u.Id, u.Image, u.Name, u.Email, u.DateCreation);
return user;
}
}
}

@ -24,5 +24,18 @@
IdSource = idSource;
IdUserVerif = idUserVerif;
}
public Quote(int id, string content, int likes, string langue, bool isValide, string? reason, int idCaracter, int idSource, int? idUserVerif)
{
Id = id;
Content = content;
Likes = likes;
Langue = langue;
IsValide = isValide;
Reason = reason;
IdCaracter = idCaracter;
IdSource = idSource;
IdUserVerif = idUserVerif;
}
}
}

@ -8,5 +8,14 @@
public string Email { get; set; }
public DateTime DateCreation { get; set; }
public User(int id, string image, string name, string email, DateTime dateCreation)
{
this.Id = id;
this.Image = image;
this.Name = name;
this.Email = email;
this.DateCreation = dateCreation;
}
}
}

@ -1,9 +1,12 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=wikifantasy3;Username=postgres;Password=postgres"
}
},
"AllowedHosts": "*"
}

Loading…
Cancel
Save