Esempio n. 1
0
        public async Task <IActionResult> GetAsync(int id)
        {
            var game = await _repository.FindGameAsync(id);

            if (game == null)
            {
                return(NotFound());
            }
            return(new JsonResult(game.ToStatus()));
        }
Esempio n. 2
0
        public async Task <IActionResult> PostAsync([FromBody] AddCardParameter param)
        {
            var game = await _repository.FindGameAsync(param.GameId);

            if (game == null)
            {
                return(NotFound());
            }

            try
            {
                var cardId = await _repository.AddCardAsync(game, param.Keyword);

                return(new JsonResult(cardId));
            }
            catch (InvalidKeywordException)
            {
                return(Forbid());
            }
        }