public async Task <IActionResult> EditMasterGame([FromBody] EditMasterGameRequest viewModel) { Instant instant = _clock.GetCurrentInstant(); var possibleTags = await _interLeagueService.GetMasterGameTags(); IReadOnlyList <MasterGameTag> tags = possibleTags .Where(x => viewModel.Tags.Contains(x.Name)) .ToList(); var existingMasterGame = await _interLeagueService.GetMasterGame(viewModel.MasterGameID); if (existingMasterGame is null) { return(BadRequest()); } MasterGame masterGame = viewModel.ToDomain(existingMasterGame, instant, tags); await _interLeagueService.EditMasterGame(masterGame); var currentDate = _clock.GetToday(); var vm = new MasterGameViewModel(masterGame, currentDate); _logger.LogInformation($"Edited master game: {masterGame.MasterGameID}"); return(CreatedAtAction("MasterGame", "Game", new { id = masterGame.MasterGameID }, vm)); }
public QueuedGameViewModel(QueuedGame queuedGame, LocalDate currentDate, bool taken, bool alreadyOwned) { MasterGame = new MasterGameViewModel(queuedGame.MasterGame, currentDate); Rank = queuedGame.Rank; Taken = taken; AlreadyOwned = alreadyOwned; }
public async Task <IActionResult> CreateMasterGame([FromBody] CreateMasterGameRequest viewModel) { var possibleTags = await _interLeagueService.GetMasterGameTags(); IReadOnlyList <MasterGameTag> tags = possibleTags .Where(x => viewModel.Tags.Contains(x.Name)) .ToList(); if (!tags.Any()) { tags = new List <MasterGameTag>() { possibleTags.Single(x => x.Name == "NewGame") }; } MasterGame masterGame = viewModel.ToDomain(_clock, tags); await _interLeagueService.CreateMasterGame(masterGame); var currentDate = _clock.GetToday(); var vm = new MasterGameViewModel(masterGame, currentDate); _logger.LogInformation($"Created master game: {masterGame.MasterGameID}"); return(CreatedAtAction("MasterGame", "Game", new { id = masterGame.MasterGameID }, vm)); }
public DropGameRequestViewModel(DropRequest dropRequest, LocalDate currentDate) { DropRequestID = dropRequest.DropRequestID; PublisherID = dropRequest.Publisher.PublisherID; PublisherName = dropRequest.Publisher.PublisherName; Timestamp = dropRequest.Timestamp; Successful = dropRequest.Successful; MasterGame = new MasterGameViewModel(dropRequest.MasterGame, currentDate); }
public async Task <ActionResult <MasterGameViewModel> > MasterGame(Guid id) { var masterGame = await _fantasyCriticService.GetMasterGame(id); if (masterGame.HasNoValue) { return(NotFound()); } var viewModel = new MasterGameViewModel(masterGame.Value); return(viewModel); }
public async Task <ActionResult <MasterGameViewModel> > MasterGame(Guid id) { var masterGame = await _interLeagueService.GetMasterGame(id); if (masterGame.HasNoValue) { return(NotFound()); } var viewModel = new MasterGameViewModel(masterGame.Value, _clock); return(viewModel); }
public MasterGameChangeRequestViewModel(MasterGameChangeRequest domain, LocalDate currentDate) { RequestID = domain.RequestID; RequesterDisplayName = domain.User.UserName; MasterGame = new MasterGameViewModel(domain.MasterGame, currentDate); RequestNote = domain.RequestNote; OpenCriticID = domain.OpenCriticID; GGToken = domain.GGToken; Answered = domain.Answered; ResponseNote = domain.ResponseNote; ResponseTimestamp = domain.ResponseTimestamp; Hidden = domain.Hidden; }
public async Task <ActionResult <MasterGameViewModel> > MasterGame(Guid id) { var masterGame = await _interLeagueService.GetMasterGame(id); if (masterGame is null) { return(NotFound()); } var numberOutstandingCorrections = await _interLeagueService.GetNumberOutstandingCorrections(masterGame); var currentDate = _clock.GetToday(); var viewModel = new MasterGameViewModel(masterGame, currentDate, numberOutstandingCorrections: numberOutstandingCorrections); return(viewModel); }
public async Task <IActionResult> CreateMasterGame([FromBody] CreateMasterGameRequest viewModel) { EligibilityLevel eligibilityLevel = await _interLeagueService.GetEligibilityLevel(viewModel.EligibilityLevel); Instant instant = _clock.GetCurrentInstant(); LocalDate tomorrow = instant.ToEasternDate().PlusDays(1); var currentYear = await _interLeagueService.GetCurrentYear(); MasterGame masterGame = viewModel.ToDomain(eligibilityLevel, instant, tomorrow); await _interLeagueService.CreateMasterGame(masterGame); var vm = new MasterGameViewModel(masterGame, _clock); _logger.LogInformation($"Created master game: {masterGame.MasterGameID}"); return(CreatedAtAction("MasterGame", "Game", new { id = masterGame.MasterGameID }, vm)); }
public async Task <IActionResult> CreateMasterGame([FromBody] CreateMasterGameRequest viewModel) { Instant instant = _clock.GetCurrentInstant(); var possibleTags = await _interLeagueService.GetMasterGameTags(); IReadOnlyList <MasterGameTag> tags = possibleTags .Where(x => viewModel.GetRequestedTags().Contains(x.Name)) .ToList(); MasterGame masterGame = viewModel.ToDomain(instant, tags); await _interLeagueService.CreateMasterGame(masterGame); var vm = new MasterGameViewModel(masterGame, _clock); _logger.LogInformation($"Created master game: {masterGame.MasterGameID}"); return(CreatedAtAction("MasterGame", "Game", new { id = masterGame.MasterGameID }, vm)); }
public PickupBidViewModel(PickupBid pickupBid, LocalDate currentDate) { BidID = pickupBid.BidID; PublisherID = pickupBid.Publisher.PublisherID; PublisherName = pickupBid.Publisher.PublisherName; BidAmount = pickupBid.BidAmount; Priority = pickupBid.Priority; Timestamp = pickupBid.Timestamp.ToDateTimeUtc(); Successful = pickupBid.Successful; MasterGame = new MasterGameViewModel(pickupBid.MasterGame, currentDate); if (pickupBid.ConditionalDropPublisherGame is not null) { ConditionalDropPublisherGame = new PublisherGameViewModel(pickupBid.ConditionalDropPublisherGame, currentDate, false, false); } CounterPick = pickupBid.CounterPick; Outcome = pickupBid.Outcome; ProjectedPointsAtTimeOfBid = pickupBid.ProjectedPointsAtTimeOfBid; }
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 TagOverrideViewModel(TagOverride domain, LocalDate currentDate) { MasterGame = new MasterGameViewModel(domain.MasterGame, currentDate); Tags = domain.Tags.Select(x => x.Name).ToList(); }
public EligibilityOverrideViewModel(EligibilityOverride domain, LocalDate currentDate) { MasterGame = new MasterGameViewModel(domain.MasterGame, currentDate); Eligible = domain.Eligible; }