Exemplo n.º 1
0
    public async Task <Result> SellGame(RoyalePublisher publisher, RoyalePublisherGame publisherGame)
    {
        var currentDate = _clock.GetToday();

        if (publisherGame.MasterGame.MasterGame.IsReleased(currentDate))
        {
            return(Result.Failure("That game has already been released."));
        }
        if (publisherGame.MasterGame.MasterGame.CriticScore.HasValue)
        {
            return(Result.Failure("That game already has a score."));
        }

        if (!publisher.PublisherGames.Contains(publisherGame))
        {
            return(Result.Failure("You don't have that game."));
        }

        var masterGameTags = await _masterGameRepo.GetMasterGameTags();

        var currentlyInEligible = publisherGame.CalculateIsCurrentlyIneligible(masterGameTags);
        await _royaleRepo.SellGame(publisherGame, currentlyInEligible);

        return(Result.Success());
    }
Exemplo n.º 2
0
        public async Task <Result> SellGame(RoyalePublisher publisher, RoyalePublisherGame publisherGame)
        {
            if (publisherGame.MasterGame.MasterGame.IsReleased(_clock.GetCurrentInstant()))
            {
                return(Result.Fail("That game has already been released."));
            }
            if (publisherGame.MasterGame.MasterGame.CriticScore.HasValue)
            {
                return(Result.Fail("That game already has a score."));
            }

            if (!publisher.PublisherGames.Contains(publisherGame))
            {
                return(Result.Fail("You don't have that game."));
            }

            await _royaleRepo.SellGame(publisherGame);

            return(Result.Ok());
        }