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.
55 lines
1.7 KiB
55 lines
1.7 KiB
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
|
|
{
|
|
/// <summary>
|
|
/// define an administrator
|
|
/// attributes :
|
|
/// id : identifier in the database
|
|
/// username : username for a administrator
|
|
/// hashedPassword : hash of the password of the administrator
|
|
/// </summary>
|
|
private int id;
|
|
private string? username;
|
|
private string? hashedPassword;
|
|
/// <summary>
|
|
/// getters and setters for attributes
|
|
/// </summary>
|
|
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; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// constructor of an administrator
|
|
/// </summary>
|
|
/// <param name="username">the username of the administrator</param>
|
|
/// <param name="hashedPassword">the hash of the password of the administrator</param>
|
|
/// <param name="id">the id in the database</param>
|
|
public Administrator(string username, string hashedPassword, int id = -1)
|
|
{
|
|
this.Username = username;
|
|
this.HashedPassword = hashedPassword;
|
|
this.Id = id;
|
|
}
|
|
}
|
|
}
|