public void DeleteGame(GameEditDTO game) { var gameToDelete = _unitOfWork.GameRepository.FindById(game.Id); _unitOfWork.GameRepository.Remove(gameToDelete); _unitOfWork.Commit(); }
public void EditGame(GameEditDTO game) { var gameToEdit = _unitOfWork.GameRepository.FindById(game.Id); Mapper.Map(game, gameToEdit); SetGenres(game, gameToEdit); SetPlatforms(game, gameToEdit); if (_unitOfWork.GameRepository.Get(i => i.Key.Equals(game.Key)) == null) { _unitOfWork.GameRepository.Update(gameToEdit); _unitOfWork.Commit(); } }