コード例 #1
0
        public async Task <TeamStates> Update(TeamStates teamState)
        {
            _teamContext.Entry(teamState).State = EntityState.Modified;
            await _teamContext.SaveChangesAsync();

            return(teamState);
        }
コード例 #2
0
 public Team(TeamStates state, string div, string round, string pool, int teamNumber)
 {
     State      = state;
     Division   = div;
     Round      = round;
     Pool       = pool;
     TeamNumber = teamNumber;
 }
コード例 #3
0
        public async Task <TeamStates> Add(TeamStates teamState)
        {
            await _teamContext.TeamStates.AddAsync(teamState);

            await _teamContext.SaveChangesAsync();

            return(teamState);
        }
コード例 #4
0
        public async Task <IActionResult> PostTeamState([FromBody] TeamStates teamState)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            await _teamStateRepository.Add(teamState);

            return(Content("created_id"));
        }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
ファイル: TeamEngine.cs プロジェクト: Turnerj/RocketBot
        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));
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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"));
        }