예제 #1
0
        public IActionResult Put(Guid id, [FromBody] RoundUpsertModel round)
        {
            Round foundRound;

            if (rounds.TryGetValue(id, out foundRound))
            {
                rounds[id].users       = round.users;
                rounds[id].currentUser = round.currentUser;
                return(Ok());
            }
            return(NotFound());
        }
예제 #2
0
        public IActionResult Post([FromBody] RoundUpsertModel newRound)
        {
            Round roundToSave = new Round()
            {
                roundId     = Guid.NewGuid(),
                currentUser = newRound.currentUser,
                partyName   = newRound.partyName,
                users       = newRound.users ?? new List <Guid>()
            };

            rounds.Add(roundToSave.roundId, roundToSave);

            return(CreatedAtAction("Get", new { roundToSave.roundId }, roundToSave));
        }