using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Model { /// /// represent a mathematical question /// attributes : /// id : identifier of the question in the database /// content : the content of the question /// difficulty : difficulty (between 1 and 3 included) of the question /// 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 /// public class Question { private uint id; private string? content; private byte difficulty; private uint nbFalls; private uint idChapter; private uint? idAnswerGood; public uint Id { get => id; private set { id = value; } } public string Content { get => content == null ? "" : content; set { content = value == "" ? null : value;} } public byte Difficulty { get => difficulty; set { difficulty = value; } } public uint NbFalls { get => nbFalls; set { nbFalls = value; } } public uint IdChapter { get => idChapter; private set { idChapter = value; } } public uint? IdAnswerGood { get => idAnswerGood; set { idAnswerGood = value; } } public Question(string content, uint idChapter, uint id = 0, uint? idAnswerGood = null) { Id = id; Content = content; Difficulty = 1; NbFalls = 0; IdChapter = idChapter; IdAnswerGood = idAnswerGood; } } }