Exemplo n.º 1
0
        public ActionResult <PlayerReadDto> CreatePlayer(PlayerCreateDto playerCreateDto)
        {
            var playerModel = _mapper.Map <Players>(playerCreateDto);

            _repository.CreatePlayer(playerModel);
            _repository.SaveChanges();

            var playerReadDto = _mapper.Map <PlayerReadDto>(playerModel);

            return(CreatedAtRoute(nameof(GetPlayerbyId), new { Id = playerReadDto.Id }, playerReadDto));
        }