public async Task <ClaimResult> QueueGame(Publisher publisher, MasterGame masterGame) { IReadOnlyList <QueuedGame> queuedGames = await _fantasyCriticRepo.GetQueuedGames(publisher); bool alreadyQueued = queuedGames.Select(x => x.MasterGame.MasterGameID).Contains(masterGame.MasterGameID); if (alreadyQueued) { return(new ClaimResult(new List <ClaimError>() { new ClaimError("You already have that game queued.", false) })); } var claimRequest = new ClaimGameDomainRequest(publisher, masterGame.GameName, false, false, false, masterGame, null, null); var supportedYears = await _fantasyCriticRepo.GetSupportedYears(); var leagueYear = publisher.LeagueYear; var publishersForYear = await _fantasyCriticRepo.GetPublishersInLeagueForYear(publisher.LeagueYear); var claimResult = CanClaimGame(claimRequest, supportedYears, leagueYear, publishersForYear, null, true); if (!claimResult.Success) { return(claimResult); } var nextRank = queuedGames.Count + 1; QueuedGame queuedGame = new QueuedGame(publisher, masterGame, nextRank); await _fantasyCriticRepo.QueueGame(queuedGame); return(claimResult); }
public QueuedGameViewModel(QueuedGame queuedGame, LocalDate currentDate, bool taken, bool alreadyOwned) { MasterGame = new MasterGameViewModel(queuedGame.MasterGame, currentDate); Rank = queuedGame.Rank; Taken = taken; AlreadyOwned = alreadyOwned; }
public QueuedGameViewModel(QueuedGame queuedGame, IClock clock) { MasterGame = new MasterGameViewModel(queuedGame.MasterGame, clock); Rank = queuedGame.Rank; }
public Task QueueGame(QueuedGame queuedGame) { throw new NotImplementedException(); }
public Task RemoveQueuedGame(QueuedGame queuedGame) { return(_fantasyCriticRepo.RemoveQueuedGame(queuedGame)); }
public QueuedGameEntity(QueuedGame domain) { PublisherID = domain.Publisher.PublisherID; MasterGameID = domain.MasterGame.MasterGameID; Rank = domain.Rank; }