Exemplo n.º 1
0
        public async Task <PlayerModel> UpdatePlayerAsync(long teamId, long playerId, PlayerModel updatedPlayer)
        {
            await ValidateTeamAndPlaterAsync(teamId, playerId);

            await _footballRepository.UpdatePlayerAsync(teamId, playerId, _mapper.Map <PlayerEntity>(updatedPlayer));

            var result = await _footballRepository.SaveChangesAsync();

            if (!result)
            {
                throw new Exception("Database Error");
            }

            return(updatedPlayer);
        }