refactor : modification de "uint" en "int"

API
Damien NORTIER 1 year ago
parent 0e3032a9eb
commit 1a112874e3

@ -16,7 +16,7 @@ namespace DTOs
/// </summary>
public class AdministratorDto
{
public uint Id { get; set; }
public int Id { get; set; }
public string Username { get; set; } = null!;
public string HashedPassword { get; set; } = null!;
}

@ -13,8 +13,8 @@ namespace DTOs
/// </summary>
public class AnswerDto
{
public uint Id { get; set; }
public int Id { get; set; }
public string Content { get; set; } = null!;
public uint? IdQuestion { get; set; }
public int? IdQuestion { get; set; }
}
}

@ -15,7 +15,7 @@ namespace DTOs
/// </summary>
public class ChapterDto
{
public uint Id { get; set; }
public int Id { get; set; }
public string Name { get; set; } = null!;
}
}

@ -18,10 +18,10 @@ namespace DTOs
/// </summary>
public class LobbyDto
{
public uint Id { get; set; }
public int Id { get; set; }
public string Name { get; set; } = null!;
public string Password { get; set; } = null!;
public uint NbPlayers { get; set; }
public uint? IdCreator { get; set; }
public int NbPlayers { get; set; }
public int? IdCreator { get; set; }
}
}

@ -16,7 +16,7 @@ namespace DTOs
/// </summary>
public class PlayerDto
{
public uint Id { get; set; }
public int Id { get; set; }
public string Nickname { get; set; } = null!;
public string HashedPassword { get; set; } = null!;
}

@ -20,11 +20,11 @@ namespace DTOs
/// </summary>
public class QuestionDto
{
public uint Id { get; set; }
public int Id { get; set; }
public string Content { get; set; } = null!;
public byte Difficulty { get; set; }
public uint NbFalls { get; set; }
public uint IdChapter { get; set; }
public uint? IdAnswerGood { get; set; }
public int NbFalls { get; set; }
public int IdChapter { get; set; }
public int? IdAnswerGood { get; set; }
}
}

@ -15,7 +15,7 @@ namespace Entities
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; }
public int Id { get; set; }
[Required]
public string Username { get; set; } = null!;
[Required]

@ -16,12 +16,12 @@ namespace Entities
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; }
public int Id { get; set; }
[Required]
public string Content { get; set; } = null!;
[ForeignKey(nameof(Question))]
public uint? IdQuestion { get; set; }
public int? IdQuestion { get; set; }
public QuestionEntity? Question { get; set; }
}

@ -14,7 +14,7 @@ namespace Entities
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; }
public int Id { get; set; }
[Required]
public string Name { get; set; } = null!;
}

@ -18,14 +18,14 @@ namespace Entities
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; }
public int Id { get; set; }
[Required]
public string Name { get; set; } = null!;
public string Password { get; set; } = null!;
public uint NbPlayers { get; set; }
public int NbPlayers { get; set; }
[ForeignKey(nameof(Creator))]
public uint? IdCreator { get; set; }
public int? IdCreator { get; set; }
public PlayerEntity? Creator { get; set; }
}

@ -14,14 +14,14 @@ namespace Entities
public class LobbyEntityPlayerEntity
{
[ForeignKey(nameof(Lobby))]
public uint IdLobby { get; set; }
public int IdLobby { get; set; }
[ForeignKey(nameof(Player))]
public uint IdPlayer { get; set; }
public int IdPlayer { get; set; }
public LobbyEntity Lobby { get; set; } = null!;
public PlayerEntity Player { get; set; } = null!;
public uint MaxScore { get; set; }
public int MaxScore { get; set; }
}
}

@ -15,7 +15,7 @@ namespace Entities
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; }
public int Id { get; set; }
[Required]
public string Nickname { get; set; } = null!;
[Required]

@ -21,16 +21,16 @@ namespace Entities
{
[ForeignKey(nameof(Chapter))]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public uint IdChapter { get; set; }
public int IdChapter { get; set; }
[ForeignKey(nameof(Player))]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public uint IdPlayer { get; set; }
public int IdPlayer { get; set; }
public ChapterEntity Chapter { get; set; } = null!;
public PlayerEntity Player { get; set; } = null!;
public uint MaxScore { get; set; }
public int MaxScore { get; set; }
}
}

@ -25,18 +25,18 @@ namespace Entities
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public uint Id { get; set; }
public int Id { get; set; }
[Required]
public string Content { get; set; } = null!;
[AllowedValues(1, 2, 3)]
public byte Difficulty { get; set; }
public uint NbFalls { get; set; }
public int NbFalls { get; set; }
[ForeignKey(nameof(Chapter))]
public uint IdChapter { get; set; }
public int IdChapter { get; set; }
[ForeignKey(nameof(AnswerGood))]
public uint? IdAnswerGood { get; set; }
public int? IdAnswerGood { get; set; }
public ChapterEntity? Chapter { get; set; }

@ -16,11 +16,11 @@ namespace Model
/// </summary>
public class Administrator
{
private uint id;
private int id;
private string? username;
private string? hashedPassword;
// getters and setters for attributes
public uint Id
public int Id
{
get => id;
private set { id = value; }
@ -42,7 +42,7 @@ namespace Model
/// <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, uint id = 0)
public Administrator(string username, string hashedPassword, int id = 0)
{
this.Username = username;
this.HashedPassword = hashedPassword;

@ -12,12 +12,12 @@ namespace Model
/// </summary>
public class Answer
{
private uint id;
private int id;
private string? content;
private uint? idQuestion;
private int? idQuestion;
// getters and setters for attributes
public uint Id
public int Id
{
get => id;
private set { id = value; }
@ -27,7 +27,7 @@ namespace Model
get => content == null ? "" : content;
set { content = value == "" ? null : value; }
}
public uint? IdQuestion
public int? IdQuestion
{
get => idQuestion; // null = no idQuestion
set { idQuestion = value; }
@ -39,7 +39,7 @@ namespace Model
/// <param name="content">the content of the answer</param>
/// <param name="idQuestion">the id of the question which it answer to</param>
/// <param name="id">the id in the database</param>
public Answer(string content, uint? idQuestion = null, uint id = 0)
public Answer(string content, int? idQuestion = null, int id = 0)
{
Content = content;
IdQuestion = idQuestion;

@ -15,10 +15,10 @@ namespace Model
/// </summary>
public class Chapter
{
uint id;
int id;
string? name;
// getters and setters for attributs
public uint Id
public int Id
{
get => id;
private set { id = value; }
@ -34,7 +34,7 @@ namespace Model
/// </summary>
/// <param name="name">name of the chapter</param>
/// <param name="id">id in the database</param>
public Chapter(string name, uint id = 0)
public Chapter(string name, int id = 0)
{
Name = name;
Id = id;

@ -18,13 +18,13 @@ namespace Model
/// </summary>
public class Lobby
{
private uint id;
private int id;
private string? name;
private string? password;
private uint nbPlayers;
private uint? idCreator;
private int nbPlayers;
private int? idCreator;
// getters and setters of attributes
public uint Id
public int Id
{
get => id;
private set { id = value; }
@ -39,12 +39,12 @@ namespace Model
get => password == null ? "" : password;
private set { password = value == "" ? null : value; }
}
public uint NbPlayers
public int NbPlayers
{
get => nbPlayers;
set { nbPlayers = value; }
}
public uint? IdCreator
public int? IdCreator
{
get => idCreator;
private set { idCreator = value; }
@ -58,7 +58,7 @@ namespace Model
/// <param name="password">the password require to access to the lobby</param>
/// <param name="nbPlayers">the number of players in the lobby</param>
/// <param name="id">the id of the lobby</param>
public Lobby(string name, uint? idCreator, string password = "", uint nbPlayers = 0, uint id = 0)
public Lobby(string name, int? idCreator, string password = "", int nbPlayers = 0, int id = 0)
{
Name = name;
IdCreator = idCreator;

@ -16,12 +16,12 @@ namespace Model
/// </summary>
public class Player
{
private uint id;
private int id;
private string? nickname;
private string? hashedPassword;
// getters and setters for attributes
public uint Id
public int Id
{
get => id;
private set { id = value; }
@ -43,7 +43,7 @@ namespace Model
/// <param name="nickname">nickname of the player</param>
/// <param name="hashedPassword">hash of the password of the player</param>
/// <param name="id">id of the player</param>
public Player(string nickname, string hashedPassword = "", uint id = 0)
public Player(string nickname, string hashedPassword = "", int id = 0)
{
Nickname = nickname;
HashedPassword = hashedPassword;

@ -20,14 +20,14 @@ namespace Model
/// </summary>
public class Question
{
private uint id;
private int id;
private string? content;
private byte difficulty;
private uint nbFalls;
private uint idChapter;
private uint? idAnswerGood;
private int nbFalls;
private int idChapter;
private int? idAnswerGood;
public uint Id
public int Id
{
get => id;
private set { id = value; }
@ -42,23 +42,23 @@ namespace Model
get => difficulty;
set { difficulty = value; }
}
public uint NbFalls
public int NbFalls
{
get => nbFalls;
set { nbFalls = value; }
}
public uint IdChapter
public int IdChapter
{
get => idChapter;
private set { idChapter = value; }
}
public uint? IdAnswerGood
public int? IdAnswerGood
{
get => idAnswerGood;
set { idAnswerGood = value; }
}
public Question(string content, uint idChapter, uint id = 0, uint? idAnswerGood = null)
public Question(string content, int idChapter, int id = 0, int? idAnswerGood = null)
{
Id = id;
Content = content;

Loading…
Cancel
Save