ajout du boardlayout et de la commande getmatch
This commit was merged in pull request #8.
This commit is contained in:
43
Src/Giants.Core/Src/Commands/GetMatchCommand.cs
Normal file
43
Src/Giants.Core/Src/Commands/GetMatchCommand.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
using Giants.Core.Interfaces;
|
||||
|
||||
namespace Giants.Core.Commands;
|
||||
|
||||
/// <summary>
|
||||
/// Logique metier qui permet d'ajouter les données statiques aux matchs qui arrivent du repository
|
||||
/// </summary>
|
||||
public class GetMatchCommand : BaseCommand<GetMatchResult>
|
||||
{
|
||||
private IMatchRepository _repo;
|
||||
|
||||
/// <summary> L'id du match a récupérer </summary>
|
||||
public required int MatchId { get; init; }
|
||||
|
||||
public GetMatchCommand(IMatchRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
protected override GetMatchResult LocalExecute()
|
||||
{
|
||||
Match? m = _repo.GetMatch(MatchId);
|
||||
if (null != m)
|
||||
{
|
||||
|
||||
GetMatchResult result = new GetMatchResult()
|
||||
{
|
||||
Success = true,
|
||||
Match = m
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
||||
return new GetMatchResult() { };
|
||||
}
|
||||
}
|
||||
|
||||
public class GetMatchResult : BaseCommandResult
|
||||
{
|
||||
/// <summary> Le match si success null sinon </summary>
|
||||
public Match? Match { get; init; }
|
||||
}
|
||||
Reference in New Issue
Block a user