Beispiel #1
0
        public async Task <Maybe <MasterGameRequest> > GetMasterGameRequest(Guid requestID)
        {
            var sql = "select * from tbl_mastergame_request where RequestID = @requestID";

            using (var connection = new MySqlConnection(_connectionString))
            {
                MasterGameRequestEntity entity = await connection.QuerySingleOrDefaultAsync <MasterGameRequestEntity>(sql, new { requestID });

                if (entity == null)
                {
                    return(Maybe <MasterGameRequest> .None);
                }

                var eligibilityLevel = await GetEligibilityLevel(entity.EligibilityLevel);

                Maybe <MasterGame> masterGame = Maybe <MasterGame> .None;
                if (entity.MasterGameID.HasValue)
                {
                    masterGame = await GetMasterGame(entity.MasterGameID.Value);
                }

                var user = await _userStore.FindByIdAsync(entity.UserID.ToString(), CancellationToken.None);

                return(entity.ToDomain(user, eligibilityLevel, masterGame));
            }
        }
Beispiel #2
0
    public async Task CreateMasterGameRequest(MasterGameRequest domainRequest)
    {
        var entity = new MasterGameRequestEntity(domainRequest);

        await using var connection = new MySqlConnection(_connectionString);
        await connection.ExecuteAsync(
            "insert into tbl_mastergame_request(RequestID,UserID,RequestTimestamp,RequestNote,GameName,SteamID,OpenCriticID,GGToken,ReleaseDate,EstimatedReleaseDate," +
            "Answered,ResponseTimestamp,ResponseNote,MasterGameID,Hidden) VALUES " +
            "(@RequestID,@UserID,@RequestTimestamp,@RequestNote,@GameName,@SteamID,@OpenCriticID,@GGToken,@ReleaseDate,@EstimatedReleaseDate," +
            "@Answered,@ResponseTimestamp,@ResponseNote,@MasterGameID,@Hidden);",
            entity);
    }
Beispiel #3
0
        public async Task CreateMasterGameRequest(MasterGameRequest domainRequest)
        {
            var entity = new MasterGameRequestEntity(domainRequest);

            using (var connection = new MySqlConnection(_connectionString))
            {
                await connection.ExecuteAsync(
                    "insert into tbl_mastergame_request(RequestID,UserID,RequestTimestamp,RequestNote,GameName,SteamID,OpenCriticID,EstimatedReleaseDate,EligibilityLevel," +
                    "YearlyInstallment,EarlyAccess,FreeToPlay,ReleasedInternationally,ExpansionPack,Answered,ResponseTimestamp,ResponseNote,MasterGameID,Hidden) VALUES " +
                    "(@RequestID,@UserID,@RequestTimestamp,@RequestNote,@GameName,@SteamID,@OpenCriticID,@EstimatedReleaseDate," +
                    "@EligibilityLevel,@YearlyInstallment,@EarlyAccess,@FreeToPlay,@ReleasedInternationally,@ExpansionPack,@Answered,@ResponseTimestamp,@ResponseNote,@MasterGameID,@Hidden);",
                    entity);
            }
        }
Beispiel #4
0
    public async Task <MasterGameRequest?> GetMasterGameRequest(Guid requestID)
    {
        var sql = "select * from tbl_mastergame_request where RequestID = @requestID";

        await using var connection = new MySqlConnection(_connectionString);
        MasterGameRequestEntity entity = await connection.QuerySingleOrDefaultAsync <MasterGameRequestEntity>(sql, new { requestID });

        if (entity == null)
        {
            return(null);
        }

        MasterGame?masterGame = null;

        if (entity.MasterGameID.HasValue)
        {
            masterGame = await GetMasterGame(entity.MasterGameID.Value);
        }

        var user = await _userStore.FindByIdAsync(entity.UserID.ToString(), CancellationToken.None);

        return(entity.ToDomain(user, masterGame));
    }