コード例 #1
0
        public ActionResult <GamesReadDto> CreateGame(GamesCreateDto gameCreateDto)
        {
            var gameModel = _mapper.Map <Games>(gameCreateDto);

            _repository.CreateGame(gameModel);
            _repository.SaveChanges();

            var gameReadDto = _mapper.Map <GamesReadDto>(gameModel);

            return(CreatedAtRoute(nameof(GetGameById), new { Id = gameReadDto.Id }, gameReadDto));
        }