public MasterGameRequestEntity(MasterGameRequest domain)
        {
            RequestID        = domain.RequestID;
            UserID           = domain.User.UserID;
            RequestTimestamp = domain.RequestTimestamp.ToDateTimeUtc();
            RequestNote      = domain.RequestNote;

            GameName             = domain.GameName;
            SteamID              = domain.SteamID;
            OpenCriticID         = domain.OpenCriticID;
            ReleaseDate          = domain.ReleaseDate?.ToDateTimeUnspecified();
            EstimatedReleaseDate = domain.EstimatedReleaseDate;

            EligibilityLevel        = domain.EligibilityLevel.Level;
            YearlyInstallment       = domain.YearlyInstallment;
            EarlyAccess             = domain.EarlyAccess;
            FreeToPlay              = domain.FreeToPlay;
            ReleasedInternationally = domain.ReleasedInternationally;
            ExpansionPack           = domain.ExpansionPack;
            UnannouncedGame         = domain.UnannouncedGame;

            Answered          = domain.Answered;
            ResponseTimestamp = domain.ResponseTimestamp?.ToDateTimeUtc();
            ResponseNote      = domain.ResponseNote;

            if (domain.MasterGame.HasValue)
            {
                MasterGameID = domain.MasterGame.Value.MasterGameID;
            }

            Hidden = domain.Hidden;
        }
    public MasterGameRequestEntity(MasterGameRequest domain)
    {
        RequestID        = domain.RequestID;
        UserID           = domain.User.Id;
        RequestTimestamp = domain.RequestTimestamp;
        RequestNote      = domain.RequestNote;

        GameName             = domain.GameName;
        SteamID              = domain.SteamID;
        OpenCriticID         = domain.OpenCriticID;
        GGToken              = domain.GGToken;
        ReleaseDate          = domain.ReleaseDate;
        EstimatedReleaseDate = domain.EstimatedReleaseDate;

        Answered          = domain.Answered;
        ResponseTimestamp = domain.ResponseTimestamp;
        ResponseNote      = domain.ResponseNote;

        if (domain.MasterGame is not null)
        {
            MasterGameID = domain.MasterGame.MasterGameID;
        }

        Hidden = domain.Hidden;
    }
        public MasterGameRequestViewModel(MasterGameRequest domain, IClock clock)
        {
            RequestID            = domain.RequestID;
            RequesterDisplayName = domain.User.DisplayName;
            GameName             = domain.GameName;
            ReleaseDate          = domain.ReleaseDate;
            EstimatedReleaseDate = domain.EstimatedReleaseDate;
            SteamID      = domain.SteamID;
            OpenCriticID = domain.OpenCriticID;

            EligibilityLevel        = domain.EligibilityLevel.Level;
            YearlyInstallment       = domain.YearlyInstallment;
            EarlyAccess             = domain.EarlyAccess;
            FreeToPlay              = domain.FreeToPlay;
            ReleasedInternationally = domain.ReleasedInternationally;
            ExpansionPack           = domain.ExpansionPack;
            UnannouncedGame         = domain.UnannouncedGame;

            Answered          = domain.Answered;
            ResponseNote      = domain.ResponseNote;
            ResponseTimestamp = domain.ResponseTimestamp;
            if (domain.MasterGame.HasValue)
            {
                MasterGame = new MasterGameViewModel(domain.MasterGame.Value, clock);
            }
            Hidden      = domain.Hidden;
            RequestNote = domain.RequestNote;
        }
Esempio n. 4
0
        private async Task <IReadOnlyList <MasterGameRequest> > ConvertMasterGameRequestEntities(IEnumerable <MasterGameRequestEntity> entities)
        {
            var eligibilityLevels = await GetEligibilityLevels();

            var masterGames = await GetMasterGames();

            var users = await _userStore.GetAllUsers();

            List <MasterGameRequest> domainRequests = new List <MasterGameRequest>();

            foreach (var entity in entities)
            {
                EligibilityLevel   eligibilityLevel = eligibilityLevels.Single(x => x.Level == entity.EligibilityLevel);
                Maybe <MasterGame> masterGame       = Maybe <MasterGame> .None;
                if (entity.MasterGameID.HasValue)
                {
                    masterGame = masterGames.Single(x => x.MasterGameID == entity.MasterGameID.Value);
                }

                MasterGameRequest domain = entity.ToDomain(users.Single(x => x.UserID == entity.UserID), eligibilityLevel, masterGame);
                domainRequests.Add(domain);
            }

            return(domainRequests);
        }
Esempio n. 5
0
    public async Task DismissMasterGameRequest(MasterGameRequest masterGameRequest)
    {
        var dismissObject = new
        {
            requestID = masterGameRequest.RequestID
        };

        await using var connection = new MySqlConnection(_connectionString);
        await connection.ExecuteAsync(
            "update tbl_mastergame_request SET Hidden = 1 where RequestID = @requestID;",
            dismissObject);
    }
Esempio n. 6
0
    public async Task DeleteMasterGameRequest(MasterGameRequest request)
    {
        var deleteObject = new
        {
            requestID = request.RequestID
        };

        await using var connection = new MySqlConnection(_connectionString);
        await connection.ExecuteAsync(
            "delete from tbl_mastergame_request where RequestID = @requestID;",
            deleteObject);
    }
Esempio n. 7
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);
    }
Esempio n. 8
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);
            }
        }
Esempio n. 9
0
        public async Task <IActionResult> CreateMasterGameRequest([FromBody] MasterGameRequestRequest request)
        {
            var currentUser = await _userManager.FindByNameAsync(User.Identity.Name);

            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            MasterGameRequest domainRequest = request.ToDomain(currentUser, _clock.GetCurrentInstant());

            await _interLeagueService.CreateMasterGameRequest(domainRequest);

            return(Ok());
        }
Esempio n. 10
0
    public async Task <IActionResult> CreateMasterGameRequest([FromBody] MasterGameRequestRequest request)
    {
        var currentUserResult = await GetCurrentUser();

        if (currentUserResult.IsFailure)
        {
            return(BadRequest(currentUserResult.Error));
        }
        var currentUser = currentUserResult.Value;


        MasterGameRequest domainRequest = request.ToDomain(currentUser, _clock.GetCurrentInstant());

        await _interLeagueService.CreateMasterGameRequest(domainRequest);

        return(Ok());
    }
Esempio n. 11
0
        public MasterGameRequestViewModel(MasterGameRequest domain, IClock clock)
        {
            RequestID            = domain.RequestID;
            RequesterDisplayName = domain.User.DisplayName;
            GameName             = domain.GameName;
            ReleaseDate          = domain.ReleaseDate;
            EstimatedReleaseDate = domain.EstimatedReleaseDate;
            SteamID      = domain.SteamID;
            OpenCriticID = domain.OpenCriticID;

            Answered          = domain.Answered;
            ResponseNote      = domain.ResponseNote;
            ResponseTimestamp = domain.ResponseTimestamp;
            if (domain.MasterGame.HasValue)
            {
                MasterGame = new MasterGameViewModel(domain.MasterGame.Value, clock);
            }
            Hidden      = domain.Hidden;
            RequestNote = domain.RequestNote;
        }
Esempio n. 12
0
    public MasterGameRequestViewModel(MasterGameRequest domain, LocalDate currentDate)
    {
        RequestID            = domain.RequestID;
        RequesterDisplayName = domain.User.UserName;
        GameName             = domain.GameName;
        ReleaseDate          = domain.ReleaseDate;
        EstimatedReleaseDate = domain.EstimatedReleaseDate;
        SteamID      = domain.SteamID;
        OpenCriticID = domain.OpenCriticID;
        GGToken      = domain.GGToken;

        Answered          = domain.Answered;
        ResponseNote      = domain.ResponseNote;
        ResponseTimestamp = domain.ResponseTimestamp;
        if (domain.MasterGame is not null)
        {
            MasterGame = new MasterGameViewModel(domain.MasterGame, currentDate);
        }
        Hidden      = domain.Hidden;
        RequestNote = domain.RequestNote;
    }
Esempio n. 13
0
    public async Task CompleteMasterGameRequest(MasterGameRequest masterGameRequest, Instant responseTime, string responseNote, MasterGame?masterGame)
    {
        Guid?masterGameID = null;

        if (masterGame is not null)
        {
            masterGameID = masterGame.MasterGameID;
        }
        string sql = "update tbl_mastergame_request set Answered = 1, ResponseTimestamp = @responseTime, " +
                     "ResponseNote = @responseNote, MasterGameID = @masterGameID where RequestID = @requestID;";

        await using var connection = new MySqlConnection(_connectionString);
        await connection.ExecuteAsync(sql,
                                      new
        {
            requestID = masterGameRequest.RequestID,
            masterGameID,
            responseTime = responseTime.ToDateTimeUtc(),
            responseNote
        });
    }
Esempio n. 14
0
    private async Task <IReadOnlyList <MasterGameRequest> > ConvertMasterGameRequestEntities(IEnumerable <MasterGameRequestEntity> entities)
    {
        var masterGames = await GetMasterGames();

        var users = await _userStore.GetAllUsers();

        List <MasterGameRequest> domainRequests = new List <MasterGameRequest>();

        foreach (var entity in entities)
        {
            MasterGame?masterGame = null;
            if (entity.MasterGameID.HasValue)
            {
                masterGame = masterGames.Single(x => x.MasterGameID == entity.MasterGameID.Value);
            }

            MasterGameRequest domain = entity.ToDomain(users.Single(x => x.Id == entity.UserID), masterGame);
            domainRequests.Add(domain);
        }

        return(domainRequests);
    }
Esempio n. 15
0
        public MasterGameRequestEntity(MasterGameRequest domain)
        {
            RequestID        = domain.RequestID;
            UserID           = domain.User.UserID;
            RequestTimestamp = domain.RequestTimestamp.ToDateTimeUtc();
            RequestNote      = domain.RequestNote;

            GameName             = domain.GameName;
            SteamID              = domain.SteamID;
            OpenCriticID         = domain.OpenCriticID;
            ReleaseDate          = domain.ReleaseDate?.ToDateTimeUnspecified();
            EstimatedReleaseDate = domain.EstimatedReleaseDate;

            Answered          = domain.Answered;
            ResponseTimestamp = domain.ResponseTimestamp?.ToDateTimeUtc();
            ResponseNote      = domain.ResponseNote;

            if (domain.MasterGame.HasValue)
            {
                MasterGameID = domain.MasterGame.Value.MasterGameID;
            }

            Hidden = domain.Hidden;
        }
Esempio n. 16
0
 public Task CreateMasterGameRequest(MasterGameRequest domainRequest)
 {
     return(_masterGameRepo.CreateMasterGameRequest(domainRequest));
 }
Esempio n. 17
0
 public Task DismissMasterGameRequest(MasterGameRequest masterGameRequest)
 {
     return(_masterGameRepo.DismissMasterGameRequest(masterGameRequest));
 }
Esempio n. 18
0
 public Task CompleteMasterGameRequest(MasterGameRequest masterGameRequest, Instant responseTime,
                                       string responseNote, MasterGame?masterGame)
 {
     return(_masterGameRepo.CompleteMasterGameRequest(masterGameRequest, responseTime, responseNote, masterGame));
 }
Esempio n. 19
0
 public Task DeleteMasterGameRequest(MasterGameRequest request)
 {
     return(_masterGameRepo.DeleteMasterGameRequest(request));
 }
Esempio n. 20
0
 public Task CompleteMasterGameRequest(MasterGameRequest masterGameRequest, Instant responseTime, string responseNote, Maybe <MasterGame> masterGame)
 {
     throw new NotImplementedException();
 }
Esempio n. 21
0
 public Task DeleteMasterGameRequest(MasterGameRequest request)
 {
     throw new NotImplementedException();
 }
Esempio n. 22
0
 public Task CreateMasterGameRequest(MasterGameRequest domainRequest)
 {
     throw new NotImplementedException();
 }
Esempio n. 23
0
 public Task DismissMasterGameRequest(MasterGameRequest masterGameRequest)
 {
     throw new NotImplementedException();
 }