|
|
|
@ -155,5 +155,133 @@ namespace Dto2Entities
|
|
|
|
|
// --------------------------- ToEntity --------------------------- \\
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static Character ToEntity(this CharacterDTO item)
|
|
|
|
|
{
|
|
|
|
|
Character character = new Character();
|
|
|
|
|
character.Id = item.Id;
|
|
|
|
|
character.Name = item.Name;
|
|
|
|
|
character.Images.ImgPath = item.imagePath ;
|
|
|
|
|
return character;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Commentary ToEntity(this CommentaryDTO item)
|
|
|
|
|
{
|
|
|
|
|
Commentary commentary = new Commentary();
|
|
|
|
|
commentary.Id = item.Id;
|
|
|
|
|
commentary.DateCommentary = item.Date;
|
|
|
|
|
commentary.Comment = item.Comment;
|
|
|
|
|
commentary.User.UserName = item.User;
|
|
|
|
|
commentary.User.Images.ImgPath = item.ImagePath;
|
|
|
|
|
return commentary;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Surement a refaire car Faoirite Entity modifier sur branche EF
|
|
|
|
|
public static Favorite ToEntity(this FavoriteDTO item)
|
|
|
|
|
{
|
|
|
|
|
Favorite favorite = new Favorite();
|
|
|
|
|
favorite.IdUsers = item.IdUser;
|
|
|
|
|
favorite.IdQuote = item.IdQuote;
|
|
|
|
|
return favorite;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Images ToEntity(this ImageDTO item)
|
|
|
|
|
{
|
|
|
|
|
Images image = new Images();
|
|
|
|
|
image.Id = item.IdImage;
|
|
|
|
|
image.ImgPath = item.ImagePath;
|
|
|
|
|
return image;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Question ToEntity(this QuestionDTO item)
|
|
|
|
|
{
|
|
|
|
|
Question question = new Question();
|
|
|
|
|
question.Id = item.Id;
|
|
|
|
|
question.Text = item.Question;
|
|
|
|
|
question.AnswerA = item.AnswerA;
|
|
|
|
|
question.AnswerB = item.AnswerB;
|
|
|
|
|
question.AnswerC = item.AnswerC;
|
|
|
|
|
question.AnswerD = item.AnswerD;
|
|
|
|
|
question.CorrectAnswer = item.CorrectAnswer;
|
|
|
|
|
return question;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Quiz ToEntity(this QuizDTO item)
|
|
|
|
|
{
|
|
|
|
|
Quiz quiz = new Quiz();
|
|
|
|
|
quiz.Id = item.Id;
|
|
|
|
|
quiz.NbQuestion = item.NbQuestion;
|
|
|
|
|
quiz.Title = item.Title;
|
|
|
|
|
quiz.Images.ImgPath = item.ImagePath;
|
|
|
|
|
return quiz;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Surement a refaire car QuizQuestion Entity modifier sur branche EF
|
|
|
|
|
public static QuizQuestion ToEntity(this QuizQuestionDTO item)
|
|
|
|
|
{
|
|
|
|
|
QuizQuestion quizQuestion = new QuizQuestion();
|
|
|
|
|
quizQuestion.IdQuiz = item.IdQuiz;
|
|
|
|
|
quizQuestion.IdQuestion = item.IdQuestion;
|
|
|
|
|
return quizQuestion;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Quote ToEntity(this QuoteDTO item)
|
|
|
|
|
{
|
|
|
|
|
Quote quote = new Quote();
|
|
|
|
|
quote.Id = item.Id;
|
|
|
|
|
quote.Content = item.Content;
|
|
|
|
|
quote.Source.Year = item.DateSource;
|
|
|
|
|
quote.Character.Name = item.Character;
|
|
|
|
|
quote.Source.Title = item.TitleSource;
|
|
|
|
|
quote.Langage = item.Langage.ToEntity();
|
|
|
|
|
quote.Character.Images.ImgPath = item.ImagePath;
|
|
|
|
|
quote.Likes = item.Like;
|
|
|
|
|
quote.Source.TypeSrc = item.Type.ToEntity();
|
|
|
|
|
return quote;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Source ToEntity(this SourceDTO item)
|
|
|
|
|
{
|
|
|
|
|
Source source = new Source();
|
|
|
|
|
source.Id = item.Id;
|
|
|
|
|
source.Year = item.Date;
|
|
|
|
|
source.Title = item.Title;
|
|
|
|
|
source.TypeSrc = item.Type.ToEntity();
|
|
|
|
|
return source;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Users ToEntity(this UserDTO item)
|
|
|
|
|
{
|
|
|
|
|
Users user = new Users();
|
|
|
|
|
user.Id = item.Id;
|
|
|
|
|
user.UserName = item.Pseudo;
|
|
|
|
|
user.Password = item.Password;
|
|
|
|
|
user.Email = item.Email;
|
|
|
|
|
user.Created = item.date;
|
|
|
|
|
user.Images.ImgPath = item.ImageProfil;
|
|
|
|
|
return user;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static LangEnum ToEntity(this TypeLangageDTO item)
|
|
|
|
|
{
|
|
|
|
|
switch (item)
|
|
|
|
|
{
|
|
|
|
|
case TypeLangageDTO.vf: return LangEnum.vf;
|
|
|
|
|
case TypeLangageDTO.vo: return LangEnum.vo;
|
|
|
|
|
case TypeLangageDTO.ve: return LangEnum.ve;
|
|
|
|
|
default: return LangEnum.vo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static TypeSrcEnum ToEntity(this TypeSrcEnumDTO item)
|
|
|
|
|
{
|
|
|
|
|
switch (item)
|
|
|
|
|
{
|
|
|
|
|
case TypeSrcEnumDTO.movie: return TypeSrcEnum.movie;
|
|
|
|
|
case TypeSrcEnumDTO.book: return TypeSrcEnum.book;
|
|
|
|
|
case TypeSrcEnumDTO.serie: return TypeSrcEnum.series;
|
|
|
|
|
case TypeSrcEnumDTO.videogame: return TypeSrcEnum.videogame;
|
|
|
|
|
default: return TypeSrcEnum.movie;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|