Exemple #1
0
        public IHttpActionResult UpdateDuel(DuelDto duel)
        {
            var session = this.sessionRepository.Get(Guid.Parse(duel.SessionId));
            if (session.IsClosed) return BadRequest();

            session.MakeDecision(duel.ToDuel(), new Option(duel.Winner), this.gateway);
            this.sessionRepository.Update(session);

            return Ok();
        }
Exemple #2
0
        public IHttpActionResult GetDuel(string sessionId)
        {
            var session = this.sessionRepository.Get(Guid.Parse(sessionId));
            if (session.IsClosed) return BadRequest();

            var duel = session.NextDuel();
            this.sessionRepository.Update(session);

            var competition = this.competitionRepository.Get(session.CompetitionId);

            var duelDto = new DuelDto(duel, competition.Subject);

            return Ok(duelDto);
        }