You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3.01-QCM_MuscuMaths/WebApi/Model/Answer.cs

54 lines
1.3 KiB

namespace Model
{
/// <summary>
/// define an answer for a Question with Mutiple Choice
/// variable :
/// id : identifier in the database
/// content : content of the answer
/// </summary>
public class Answer
{
private int id;
private string? content;
/// <summary>
/// property for id manipulations
/// </summary>
public int Id
{
get
{
return id;
}
private set
{
id = value < -1 ? -1 : value;
}
}
/// <summary>
/// property for content manipulations
/// </summary>
public string Content
{
get
{
return content == null ? "" : content;
}
set
{
content = value == "" ? null : value;
}
}
/// <summary>
/// constructor of an answer
/// </summary>
/// <param name="content">the content of an answer</param>
/// <param name="id">the id of an answer</param>
public Answer(string content, int id = -1)
{
Id = id;
Content = content;
}
}
}