Esempio n. 1
0
        public async Task <string> BuyChampionForUser(ApiChampions champion, string userName)
        {
            var account = await _accountRepository.getUserByUsername(userName);

            if (account.AccountStatistics.Gold < champion.Cost)
            {
                return("Insufficient gold!");
            }
            Champions champ = await GetChampionFromDB(champion);

            ChampionsOwned champOwned = CreateChampionForAccount(userName, champ);
            await _championsRepository.BuyChampionForAccount(champOwned);

            return("Character successfully added to your collection!");
        }