using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class Chapter
{
///
/// define a mathematical chapter or thematic
/// attributes :
/// id : identifier in the database
/// name : name of the chapter
///
int id;
string? name;
///
/// getters and setters for attributs
///
public int? Id
{
get => id == -1 ? null : id ;
private set { id = value == null || value < -1 ? -1 : value.Value; }
}
public string Name
{
get => name == null ? "" : name;
set { name = value == "" ? null : value; }
}
///
/// custructor of a mathematical chapter
///
/// name of the chapter
/// id in the database
public Chapter(string name, int? id = null)
{
Name = name;
Id = id;
}
}
}