using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Model { public class Administrator { /// /// define an administrator /// attributes : /// id : identifier in the database /// username : username for a administrator /// hashedPassword : hash of the password of the administrator /// private int id; private string? username; private string? hashedPassword; /// /// getters and setters for attributes /// public int Id { get => id; private set { id = value < -1 ? -1 : value; } } public string Username { get { return username == null ? "" : username; } private set { username = value == "" ? null : value; } } public string HashedPassword { get => hashedPassword == null ? "" : hashedPassword; set { hashedPassword = value == "" ? null : value; } } /// /// constructor of an administrator /// /// the username of the administrator /// the hash of the password of the administrator /// the id in the database public Administrator(string username, string hashedPassword, int id = -1) { this.Username = username; this.HashedPassword = hashedPassword; this.Id = id; } } }