public async Task <TeamStates> Update(TeamStates teamState) { _teamContext.Entry(teamState).State = EntityState.Modified; await _teamContext.SaveChangesAsync(); return(teamState); }
public Team(TeamStates state, string div, string round, string pool, int teamNumber) { State = state; Division = div; Round = round; Pool = pool; TeamNumber = teamNumber; }
public async Task <TeamStates> Add(TeamStates teamState) { await _teamContext.TeamStates.AddAsync(teamState); await _teamContext.SaveChangesAsync(); return(teamState); }
public async Task <IActionResult> PostTeamState([FromBody] TeamStates teamState) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await _teamStateRepository.Add(teamState); return(Content("created_id")); }
public override int GetHashCode() { unchecked { var hashCode = ActivePlaytime.GetHashCode(); hashCode = (hashCode * 397) ^ (int)MatchEndReason; hashCode = (hashCode * 397) ^ (PlayerStates?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (TeamStates?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (int)VictoryCondition; return(hashCode); } }
public static TeamEngine JoinTeam(int playerIndex, int team) { var teamState = new TeamState(); teamState.AddPlayer(playerIndex); TeamStates.AddOrUpdate(team, teamState, (existingTeam, existingTeamState) => { existingTeamState.AddPlayer(playerIndex); return(existingTeamState); }); return(new TeamEngine(playerIndex, team)); }
public bool Equals(MatchEnd other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(false); } return(ActivePlaytime.Equals(other.ActivePlaytime) && MatchEndReason == other.MatchEndReason && PlayerStates.OrderBy(ps => ps.Key).SequenceEqual(other.PlayerStates.OrderBy(ps => ps.Key)) && TeamStates.OrderBy(ts => ts.Key).SequenceEqual(other.TeamStates.OrderBy(ts => ts.Key)) && VictoryCondition == other.VictoryCondition); }
public async Task <IActionResult> PutTeamState([FromBody] TeamStates teamState) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { await _teamStateRepository.Update(teamState); } catch (DbUpdateConcurrencyException) { return(StatusCode(500, "Something wrong")); } return(Ok("Success")); }