|
|
|
@ -27,7 +27,7 @@ namespace Stub
|
|
|
|
|
public GamesManager(StubData parent)
|
|
|
|
|
=> this.parent = parent;
|
|
|
|
|
|
|
|
|
|
public Task<bool> IGamesManager.AddCaseValueToPlayer(int idGame, int idPlayer, int value, int index)
|
|
|
|
|
public Task<bool> AddCaseValueToPlayer(int idGame, int idPlayer, int value, int index)
|
|
|
|
|
{
|
|
|
|
|
var game = parent.games.FirstOrDefault(g => g.Id == idGame);
|
|
|
|
|
if(game == null)
|
|
|
|
@ -43,7 +43,7 @@ namespace Stub
|
|
|
|
|
return Task.FromResult(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<bool> IGamesManager.AddPlayer(Player player)
|
|
|
|
|
public Task<bool> AddPlayer(Player player)
|
|
|
|
|
{
|
|
|
|
|
var game = parent.games.FirstOrDefault();
|
|
|
|
|
if(game == null)
|
|
|
|
@ -54,7 +54,7 @@ namespace Stub
|
|
|
|
|
return Task.FromResult(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<bool> IGamesManager.AddScoreToPlayer(int idGame, int idPlayer, int score)
|
|
|
|
|
public Task<bool> AddScoreToPlayer(int idGame, int idPlayer, int score)
|
|
|
|
|
{
|
|
|
|
|
var game = parent.games.FirstOrDefault(g => g.Id == idGame);
|
|
|
|
|
if( game == null)
|
|
|
|
@ -70,7 +70,7 @@ namespace Stub
|
|
|
|
|
return Task.FromResult(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<bool> IGamesManager.AddTime(TimeSpan time)
|
|
|
|
|
public Task<bool> AddTime(TimeSpan time)
|
|
|
|
|
{
|
|
|
|
|
var game = parent.games.FirstOrDefault();
|
|
|
|
|
if (game == null)
|
|
|
|
@ -81,7 +81,7 @@ namespace Stub
|
|
|
|
|
return Task.FromResult(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<bool> IGamesManager.AddTurn(Turn turn)
|
|
|
|
|
public Task<bool> AddTurn(Turn turn)
|
|
|
|
|
{
|
|
|
|
|
var game = parent.games.FirstOrDefault();
|
|
|
|
|
if( game == null)
|
|
|
|
@ -92,22 +92,22 @@ namespace Stub
|
|
|
|
|
return Task.FromResult(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task<Game?> IGenericDataManager<Game?>.AddItem(Game? item)
|
|
|
|
|
public Task<Game?> AddItem(Game? item)
|
|
|
|
|
=> parent.games.AddItem(item);
|
|
|
|
|
|
|
|
|
|
public Task<bool> IGenericDataManager<Game?>.DeleteItem(Game? item)
|
|
|
|
|
public Task<bool> DeleteItem(Game? item)
|
|
|
|
|
=> parent.games.DeleteItem(item);
|
|
|
|
|
|
|
|
|
|
public Task<IEnumerable<Game?>> IGenericDataManager<Game?>.GetItems(int index, int count, string? orderingPropertyName, bool descending)
|
|
|
|
|
public Task<IEnumerable<Game?>> GetItems(int index, int count, string? orderingPropertyName, bool descending)
|
|
|
|
|
=> parent.games.GetItemsWithFilterAndOrdering(
|
|
|
|
|
g => true,
|
|
|
|
|
index, count,
|
|
|
|
|
orderingPropertyName, descending);
|
|
|
|
|
|
|
|
|
|
public Task<int> IGenericDataManager<Game?>.GetNbItems()
|
|
|
|
|
public Task<int> GetNbItems()
|
|
|
|
|
=> Task.FromResult(parent.games.Count());
|
|
|
|
|
|
|
|
|
|
public Task<Game?> IGenericDataManager<Game?>.UpdateItem(Game? oldItem, Game? newItem)
|
|
|
|
|
public Task<Game?> UpdateItem(Game? oldItem, Game? newItem)
|
|
|
|
|
=> parent.games.UpdateItem(oldItem, newItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|