🔨 ajout de plusieurs DTO et GameConverter + modifs modèle
continuous-integration/drone/push Build is failing Details

EF
Aurelien PINTRAND 2 years ago
parent 9b0b5682cd
commit 87cfb1b33e

@ -7,9 +7,9 @@ using System.Threading.Tasks;
namespace Model
{
public int Id { get; set; }
public class Grille
{
public int Id { get; set; }
public int NbChaine { get; set; }
public int NbZone { get; set; }
public int MaxChaine { get; set; }

@ -17,7 +17,7 @@ namespace Model
{
if (value > 6)
{
throw new ArgumentException("a Case must have a value lower or equal to 12");
throw new ArgumentException("a Cell must have a value lower or equal to 12");
}
diceValue1 = value;
}
@ -31,7 +31,7 @@ namespace Model
{
if (value > 6)
{
throw new ArgumentException("a Case must have a value lower or equal to 12");
throw new ArgumentException("a Cell must have a value lower or equal to 12");
}
diceValue2 = value;
}

@ -0,0 +1,9 @@
using Model;
using Trek12_API.DTO;
namespace Trek12_API.Converter
{
public class GameConverter
{
}
}

@ -1,6 +1,31 @@
namespace Trek12_API.DTO
using Model;
using System.Collections.ObjectModel;
namespace Trek12_API.DTO
{
public class GameDTO
{
public int Id { get; set; }
public TimeSpan Duration { get; set; }
public DateOnly Date { get; set; }
public List<TurnDTO> Turns { get; set; }
public Dictionary<PlayerDTO, GrilleDTO> Grilles { get; set; }
public Dictionary<PlayerDTO, int> Scores { get; set; }
public GamemodeDTO GameMode { get; set; }
public GameDTO(int id, DateOnly date, PlayerDTO owner, GamemodeDTO gameMode)
{
Date = date;
Grilles = new Dictionary<PlayerDTO, GrilleDTO>();
Scores = new Dictionary<PlayerDTO, int>();
Turns = new List<TurnDTO>();
Grilles.Add(owner, new GrilleDTO());
Scores.Add(owner, 0);
GameMode = gameMode;
Id = id;
}
}
}

@ -0,0 +1,8 @@
namespace Trek12_API.DTO
{
public class GamemodeDTO
{
public string Name { get; set; }
public int Id { get; set; }
}
}

@ -0,0 +1,11 @@
namespace Trek12_API.DTO
{
public class GrilleDTO
{
public int Id { get; set; }
public int NbChaines { get; set; }
public int NbZones { get; set; }
public int MaxChaines { get; set; }
public int MaxZones { get; set; }
}
}

@ -0,0 +1,10 @@
namespace Trek12_API.DTO
{
public class TurnDTO
{
public int Id { get; set; }
public int diceValue1 { get; set; }
public string diceValue2 { get; set; }
}
}
Loading…
Cancel
Save