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; }
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); }
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); }
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); }
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); }
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); } }
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()); }
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()); }
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; }
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; }
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 }); }
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); }
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; }
public Task CreateMasterGameRequest(MasterGameRequest domainRequest) { return(_masterGameRepo.CreateMasterGameRequest(domainRequest)); }
public Task DismissMasterGameRequest(MasterGameRequest masterGameRequest) { return(_masterGameRepo.DismissMasterGameRequest(masterGameRequest)); }
public Task CompleteMasterGameRequest(MasterGameRequest masterGameRequest, Instant responseTime, string responseNote, MasterGame?masterGame) { return(_masterGameRepo.CompleteMasterGameRequest(masterGameRequest, responseTime, responseNote, masterGame)); }
public Task DeleteMasterGameRequest(MasterGameRequest request) { return(_masterGameRepo.DeleteMasterGameRequest(request)); }
public Task CompleteMasterGameRequest(MasterGameRequest masterGameRequest, Instant responseTime, string responseNote, Maybe <MasterGame> masterGame) { throw new NotImplementedException(); }
public Task DeleteMasterGameRequest(MasterGameRequest request) { throw new NotImplementedException(); }
public Task CreateMasterGameRequest(MasterGameRequest domainRequest) { throw new NotImplementedException(); }
public Task DismissMasterGameRequest(MasterGameRequest masterGameRequest) { throw new NotImplementedException(); }