Как асинхронно вернуть список из метода?
Всем привет. Возникла следующая проблема, мне нужна из метода асинхронно вернуть список List.
class Games
{
private enum Coin
{
Орёл,
Решка
}
public List<Game> ResultGameCoin(int userId, decimal sumBet, string choice, decimal balance)
{
var resultGame = new List<Game>();
Random rnd = new Random();
Coin coinRndValue = (Coin)rnd.Next(2);
string animation = ReturnAnimationsCoinFlip(coinRndValue.ToString());
string result;
if (coinRndValue == (Coin)Enum.Parse(typeof(Coin), choice))
{
balance = sumBet * 2 - sumBet;
result = $"{char.ConvertFromUtf32(0x1F389)} Поздравляю!\n\n{char.ConvertFromUtf32(0x1F3C6)} Ты победил!\n\n{char.ConvertFromUtf32(0x1F4B0)} Ваш баланс: <b>{balance} руб</b>";
}
else
{
balance -= sumBet;
result = $"{char.ConvertFromUtf32(0x1F6D1)} Упс...не повезло {char.ConvertFromUtf32(0x1F4B8)}\n\n{char.ConvertFromUtf32(0x1F4B0)} Ваш баланс: <b>{balance} руб</b>";
}
resultGame.Add(new Game { ResultGame = result, Animation = animation, Balance = balance });
return resultGame;
}
private string ReturnAnimationsCoinFlip(string rndValue)
{
if (rndValue == "Орёл")
{
return "https://thumbs.gfycat.com/DescriptiveVagueCormorant-mobile.mp4";
}
else
{
return "https://thumbs.gfycat.com/BiodegradableMetallicArabianwildcat-mobile.mp4";
}
}
}