Exemplo n.º 1
0
        public async Task RegisterPokeBattle(PokeBattleForCreationDto pokeBattleForCreationDto)
        {
            PokeBattleData battleDataForRepo = _mapper.Map <PokeBattleData>(pokeBattleForCreationDto);

            _repo.Add(battleDataForRepo);
            var res = await _repo.SaveAll();

            if (!res)
            {
                throw new Exception($"Failed to register new PokeBattle to database. Please check battle data construction.");
            }

            System.Console.WriteLine($"PokeBattle Id {battleDataForRepo.BattleTokenId} successfully added.");
        }
Exemplo n.º 2
0
        public async Task RegisterUser(ulong discordId, string name)
        {
            UserForCreationDto userForRepo = new UserForCreationDto(discordId, name);
            User user = _mapper.Map <User>(userForRepo);

            _repo.Add(user);
            var res = await _repo.SaveAll();

            if (!res)
            {
                throw new Exception($"Failed to save on creation of user {discordId}");
            }

            Console.WriteLine($"User {discordId} successfully registered.");
        }