Exemplo n.º 1
0
        public async Task <IActionResult> MakeMove(long id, [FromBody] DTO.MakeMove dtoCommand)
        {
            //if (!ModelState.IsValid)
            //{
            //    return BadRequest("not a valid move.");
            //}

            try
            {
                MakeMove command = DTOMapper.FromDTO(id, dtoCommand);
                await _makeMoveCommandHandler.HandleCommandAsync(command);

                return(Ok());
            }
            catch (GameNotFoundException ex)
            {
                return(NotFound(ex.Message));
            }
            catch (BusinessRuleViolationException brve)
            {
                return(StatusCode(StatusCodes.Status409Conflict, brve.Violations));
            }
            //catch
            //{
            //    return StatusCode(501);
            //}
        }