|
|
@ -19,24 +19,24 @@ namespace ExtensionsClassLibrairie
|
|
|
|
// conversion methods
|
|
|
|
// conversion methods
|
|
|
|
public static Question ToModel(this QuestionEntity q)
|
|
|
|
public static Question ToModel(this QuestionEntity q)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var tmp = new Question(q.Content, q.Chapter?.ToModel(), q.Id, q.AnswerGood?.ToModel());
|
|
|
|
var tmp = new Question(q.Content, q.IdChapter, q.Id, q.IdAnswerGood);
|
|
|
|
tmp.Difficulty = q.Difficulty;
|
|
|
|
tmp.Difficulty = q.Difficulty;
|
|
|
|
tmp.NbFalls = q.NbFalls;
|
|
|
|
tmp.NbFalls = q.NbFalls;
|
|
|
|
return tmp;
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static Question ToModel(this QuestionDto q)
|
|
|
|
public static Question ToModel(this QuestionDto q)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var tmp = new Question(q.Content, q.Chapter?.ToModel(), q.Id, q.AnswerGood?.ToModel());
|
|
|
|
var tmp = new Question(q.Content, q.IdChapter, q.Id, q.IdAnswerGood);
|
|
|
|
tmp.Difficulty = q.Difficulty;
|
|
|
|
tmp.Difficulty = q.Difficulty;
|
|
|
|
tmp.NbFalls = q.NbFalls;
|
|
|
|
tmp.NbFalls = q.NbFalls;
|
|
|
|
return tmp;
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static QuestionDto ToDto(this Question q)
|
|
|
|
public static QuestionDto ToDto(this Question q)
|
|
|
|
=> new QuestionDto { Id = q.Id, Content = q.Content, AnswerGood = q.AnswerGood?.ToDto(),
|
|
|
|
=> new QuestionDto { Id = q.Id, Content = q.Content, IdAnswerGood = q.IdAnswerGood,
|
|
|
|
Chapter = q.Chapter?.ToDto(), Difficulty = q.Difficulty, NbFalls = q.NbFalls };
|
|
|
|
IdChapter = q.IdChapter, Difficulty = q.Difficulty, NbFalls = q.NbFalls };
|
|
|
|
public static QuestionEntity ToEntity(this Question q)
|
|
|
|
public static QuestionEntity ToEntity(this Question q)
|
|
|
|
=> new QuestionEntity { Id = q.Id, Content = q.Content, AnswerGood = q.AnswerGood?.ToEntity(),
|
|
|
|
=> new QuestionEntity { Id = q.Id, Content = q.Content, IdAnswerGood = q.IdAnswerGood,
|
|
|
|
Chapter = q.Chapter?.ToEntity(), Difficulty = q.Difficulty, NbFalls = q.NbFalls };
|
|
|
|
IdChapter = q.IdChapter, Difficulty = q.Difficulty, NbFalls = q.NbFalls };
|
|
|
|
|
|
|
|
|
|
|
|
// reuse other methods
|
|
|
|
// reuse other methods
|
|
|
|
public static QuestionDto ToDto(this QuestionEntity q)
|
|
|
|
public static QuestionDto ToDto(this QuestionEntity q)
|
|
|
|