public async Task <IActionResult> Edit(int id, [Bind("FireteamId,FireteamName,Member1,Member2,Member3,Member4,Member5,OperationId")] Fireteam fireteam) { if (id != fireteam.FireteamId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fireteam); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FireteamExists(fireteam.FireteamId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["OperationId"] = new SelectList(_context.Operations, "OperationId", "OperationDescription", fireteam.OperationId); return(View(fireteam)); }
public void Update(ForumRecruitmentDetail?other) { if (other is null) { return; } if (TopicId != other.TopicId) { TopicId = other.TopicId; OnPropertyChanged(nameof(TopicId)); } if (MicrophoneRequired != other.MicrophoneRequired) { MicrophoneRequired = other.MicrophoneRequired; OnPropertyChanged(nameof(MicrophoneRequired)); } if (Intensity != other.Intensity) { Intensity = other.Intensity; OnPropertyChanged(nameof(Intensity)); } if (Tone != other.Tone) { Tone = other.Tone; OnPropertyChanged(nameof(Tone)); } if (Approved != other.Approved) { Approved = other.Approved; OnPropertyChanged(nameof(Approved)); } if (ConversationId != other.ConversationId) { ConversationId = other.ConversationId; OnPropertyChanged(nameof(ConversationId)); } if (PlayerSlotsTotal != other.PlayerSlotsTotal) { PlayerSlotsTotal = other.PlayerSlotsTotal; OnPropertyChanged(nameof(PlayerSlotsTotal)); } if (PlayerSlotsRemaining != other.PlayerSlotsRemaining) { PlayerSlotsRemaining = other.PlayerSlotsRemaining; OnPropertyChanged(nameof(PlayerSlotsRemaining)); } if (!Fireteam.DeepEqualsList(other.Fireteam)) { Fireteam = other.Fireteam; OnPropertyChanged(nameof(Fireteam)); } if (!KickedPlayerIds.DeepEqualsListNaive(other.KickedPlayerIds)) { KickedPlayerIds = other.KickedPlayerIds; OnPropertyChanged(nameof(KickedPlayerIds)); } }
public async Task <IActionResult> Create([Bind("FireteamId,FireteamName,Member1,Member2,Member3,Member4,Member5,OperationId")] Fireteam fireteam) { if (ModelState.IsValid) { _context.Add(fireteam); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["OperationId"] = new SelectList(_context.Operations, "OperationId", "OperationDescription", fireteam.OperationId); return(View(fireteam)); }
public bool DeepEquals(ForumRecruitmentDetail?other) { return(other is not null && TopicId == other.TopicId && MicrophoneRequired == other.MicrophoneRequired && Intensity == other.Intensity && Tone == other.Tone && Approved == other.Approved && ConversationId == other.ConversationId && PlayerSlotsTotal == other.PlayerSlotsTotal && PlayerSlotsRemaining == other.PlayerSlotsRemaining && Fireteam.DeepEqualsList(other.Fireteam) && KickedPlayerIds.DeepEqualsListNaive(other.KickedPlayerIds)); }
public bool Equals(ForumRecruitmentDetail input) { if (input == null) { return(false); } return (( TopicId == input.TopicId || (TopicId.Equals(input.TopicId)) ) && ( MicrophoneRequired == input.MicrophoneRequired || (MicrophoneRequired != null && MicrophoneRequired.Equals(input.MicrophoneRequired)) ) && ( Intensity == input.Intensity || (Intensity != null && Intensity.Equals(input.Intensity)) ) && ( Tone == input.Tone || (Tone != null && Tone.Equals(input.Tone)) ) && ( Approved == input.Approved || (Approved != null && Approved.Equals(input.Approved)) ) && ( ConversationId == input.ConversationId || (ConversationId.Equals(input.ConversationId)) ) && ( PlayerSlotsTotal == input.PlayerSlotsTotal || (PlayerSlotsTotal.Equals(input.PlayerSlotsTotal)) ) && ( PlayerSlotsRemaining == input.PlayerSlotsRemaining || (PlayerSlotsRemaining.Equals(input.PlayerSlotsRemaining)) ) && ( Fireteam == input.Fireteam || (Fireteam != null && Fireteam.SequenceEqual(input.Fireteam)) ) && ( KickedPlayerIds == input.KickedPlayerIds || (KickedPlayerIds != null && KickedPlayerIds.SequenceEqual(input.KickedPlayerIds)) )); }
private async Task processQueue() { //pop the queue... var msg = await _dataStore.TryGetMessageAsync(); if( msg == null || msg.Id == _lastMsgId ) return; //...then grab the specified document... _lastMsgId = msg.Id; var doc = await _dataStore.TrySelectDocumentByIdAsync(msg.AsString); if( doc == null ) { await _dataStore.TryDeleteMessageAsync(msg); return; } //... and make sure the queued user hasn't already been added to another fireteam if( !await _dataStore.TryDeleteDocumentAsync(doc) ) return; //start building the fireteam _hub.Clients.Client(doc.Id).UpdateStatus("Evaluating"); var fireteam = new Fireteam(doc); var possibleMatches = _matchBuilder.Search(_dataStore.Query<MatchmakingDoc>(), fireteam); possibleMatches = _matchBuilder.Evaluate(possibleMatches, fireteam); foreach( var match in possibleMatches ) { //make sure the party wouldn't overflow the fireteam, and then try to remove the party from the DB if( fireteam.PartySize + match.Party.PartySize > fireteam.Activity.GetUsersNeeded() || !await _dataStore.TryDeleteDocumentAsync(match) ) continue; fireteam.Add(match); if( fireteam.PartySize == fireteam.Activity.GetUsersNeeded() ) break; } var fireteamClients = _hub.Clients.Clients( fireteam.Select( x => x.Id ).ToList() ); if( fireteam.PartySize == fireteam.Activity.GetUsersNeeded() ) { //send successful doc to clients await _dataStore.TryDeleteMessageAsync(msg); fireteamClients.MatchFound( fireteam.Select( x => x.Party ) ); //track analytics for each user foreach( var match in fireteam ) trackMatch(match); } else { //evaluating takes almost no time at all, so we fake it; update all users with progress Task.Run( () => { Thread.Sleep(2500); _hub.Clients.Client(doc.Id).UpdateStatus("Searching"); }); fireteamClients.UpdateProgress(fireteam.PartySize, fireteam.Activity.GetUsersNeeded()); Task.WaitAll( fireteam.Select( x => _dataStore.TryCreateDocumentAsync(x, false) ).ToArray<Task>() ); } }