diff --git a/WebApi/Model/Answer.cs b/WebApi/Model/Answer.cs
index 6e10e70..e3705b8 100644
--- a/WebApi/Model/Answer.cs
+++ b/WebApi/Model/Answer.cs
@@ -9,14 +9,12 @@ namespace Model
/// id : identifier in the database
/// content : content of the answer
/// idQuestion : the id of the question which it answer to
- /// question : the question which it answer to
///
public class Answer
{
private uint id;
private string? content;
- private uint idQuestion;
- public Question? question;
+ private uint? idQuestion;
// getters and setters for attributes
public uint Id
@@ -29,28 +27,23 @@ namespace Model
get => content == null ? "" : content;
set { content = value == "" ? null : value; }
}
- public uint IdQuestion
+ public uint? IdQuestion
{
get => idQuestion; // null = no idQuestion
- private set { idQuestion = value; }
+ set { idQuestion = value; }
}
- public Question? Question
- {
- get => question;
- private set { question = value; IdQuestion = value == null ? 0 : value.Id; }
- }
///
/// constructor of an answer
///
/// the content of the answer
+ /// the id of the question which it answer to
/// the id in the database
- /// the question which it answer to
- public Answer(string content, Question? question = null, uint id = 0)
+ public Answer(string content, uint? idQuestion = null, uint id = 0)
{
Content = content;
+ IdQuestion = idQuestion;
Id = id;
- Question = question;
}
}
diff --git a/WebApi/Model/Lobby.cs b/WebApi/Model/Lobby.cs
index c475cd6..b399a18 100644
--- a/WebApi/Model/Lobby.cs
+++ b/WebApi/Model/Lobby.cs
@@ -15,7 +15,6 @@ namespace Model
/// name : name of the lobby
/// password : password require to access at the lobby
/// idCreator : identifier of the creator player
- /// creator : the creator player
///
public class Lobby
{
@@ -24,7 +23,6 @@ namespace Model
private string? password;
private uint nbPlayers;
private uint? idCreator;
- private Player creator;
// getters and setters of attributes
public uint Id
{
@@ -51,11 +49,6 @@ namespace Model
get => idCreator;
private set { idCreator = value; }
}
- public Player Creator
- {
- get => creator;
- set { creator = value; idCreator = value.Id; }
- }
///
/// constructor of a lobby
@@ -63,12 +56,12 @@ namespace Model
/// the name of the lobby
/// the creator
/// the password require to access to the lobby
- /// the number of players in the lobby
+ /// the number of players in the lobby
/// the id of the lobby
- public Lobby(string name, Player creator, string password = "", uint nbPlayers = 0, uint id = 0)
+ public Lobby(string name, uint? idCreator, string password = "", uint nbPlayers = 0, uint id = 0)
{
Name = name;
- Creator = creator;
+ IdCreator = idCreator;
Password = password;
NbPlayers = nbPlayers;
Id = id;
diff --git a/WebApi/Model/Question.cs b/WebApi/Model/Question.cs
index cec0bec..c84c4c6 100644
--- a/WebApi/Model/Question.cs
+++ b/WebApi/Model/Question.cs
@@ -17,8 +17,6 @@ namespace Model
/// nbFails : number of time that people fail on this question
/// idChapter : identifier of the chapter of the question
/// idAnswerGood : identifier of the right answer to this question
- /// chapter : the chapter of the question
- /// answerGood : the right answer to this question
///
public class Question
{
@@ -27,9 +25,7 @@ namespace Model
private byte difficulty;
private uint nbFalls;
private uint idChapter;
- private uint idAnswerGood;
- private Chapter? chapter;
- private Answer? answerGood;
+ private uint? idAnswerGood;
public uint Id
{
@@ -56,32 +52,20 @@ namespace Model
get => idChapter;
private set { idChapter = value; }
}
- public uint IdAnswerGood
+ public uint? IdAnswerGood
{
get => idAnswerGood;
set { idAnswerGood = value; }
}
- public Chapter? Chapter
- {
- get => chapter;
- set { chapter = value; IdChapter = value == null ? 0 : value.Id; }
- }
-
- public Answer? AnswerGood
- {
- get => answerGood;
- set { answerGood = value; IdAnswerGood = value == null ? 0 : value.Id; }
- }
-
- public Question(string content, Chapter? chapter = null, uint id = 0, Answer? answerGood = null)
+ public Question(string content, uint idChapter, uint id = 0, uint? idAnswerGood = null)
{
Id = id;
Content = content;
Difficulty = 1;
NbFalls = 0;
- Chapter = chapter;
- AnswerGood = answerGood;
+ IdChapter = idChapter;
+ IdAnswerGood = idAnswerGood;
}
}
}