Exemple #1
0
        public async Task <Game> AddAsync(GameDto gameDto)
        {
            var game = _mapper.Map <Game>(gameDto);
            await _gameStore.GameRepository.AddAsync(game);

            await _gameStore.SaveAsync();

            return(game);
        }
Exemple #2
0
        public async Task <GameDto> UpdateAsync(GameDto gameDto)
        {
            var gameToUpdate = await _gameStore.GameRepository.GetAsync(gameDto.Id);

            if (gameToUpdate != null)
            {
                var game = _mapper.Map <Game>(gameDto);
                _gameStore.GameRepository.Update(game);
                await _gameStore.SaveAsync();
            }
            return(_mapper.Map <GameDto>(await _gameStore.GameRepository.GetAsync(gameDto.Id)));
        }