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.
leap-hit-server/code/server/ApiLeapHit/Mapper/GameMapper.cs

33 lines
902 B

using DataBase.Entity;
using DTO;
namespace ApiLeapHit.Mapper
{
public static class GameMapper
{
public static DTOGame ToDto(this Game game, Player winner, Player loser)
{
DTOGame dtoGame = new DTOGame()
{
gameId = game.gameId,
durationGame = game.durationGame,
nbMaxEchanges = game.nbMaxEchanges,
playerWinner = winner.ToDto(),
playerLoser = loser.ToDto()
};
return dtoGame;
}
public static Game ToGame(this DTOGame dtoGame, Player winner, Player loser)
{
return new Game
{
durationGame = dtoGame.durationGame,
nbMaxEchanges = dtoGame.nbMaxEchanges,
winner = winner.playerId,
loser = loser.playerId
};
}
}
}