Add project data

This commit is contained in:
2025-12-30 02:22:44 +01:00
parent a6316b8b06
commit 747af63a29
2301 changed files with 67690 additions and 1 deletions

View File

@@ -0,0 +1,57 @@
using DbController;
using Tabletop.Core.Models;
namespace Tabletop.Core.Services
{
public class MoveService : IModelService<Move, int>
{
public async Task CreateAsync(Move input, IDbController dbController, CancellationToken cancellationToken = default)
{
string sql = $@"INSERT INTO Moves
(
PlayerId,
GameId,
TurnNr,
MoveNr,
StartMove,
EndMove
)
VALUES
(
@PLAYER_ID
@GAME_ID,
@TURN_NR,
@MOVE_NR,
@START_MOVE,
@END_END
); {dbController.GetLastIdSql()}";
input.MoveId = await dbController.GetFirstAsync<int>(sql, input.GetParameters(), cancellationToken);
}
public Task DeleteAsync(Move input, IDbController dbController, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
public Task<Move?> GetAsync(int identifier, IDbController dbController, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
public async Task UpdateAsync(Move input, IDbController dbController, CancellationToken cancellationToken = default)
{
cancellationToken.ThrowIfCancellationRequested();
string sql = @"UPDATE Moves SET
PlayerId = @PLAYER_ID,
GameId = @GAME_ID,
TurnNr = @TURN_NR,
MoveNr = @MOVE_NR,
StartMove = @START_MOVE,
EndMove = @END_END
WHERE MoveId = @MOVE_ID";
await dbController.QueryAsync(sql, input.GetParameters(), cancellationToken);
}
}
}