public void StartRally() { var raceName = GetCompetitionName().GetAwaiter().GetResult(); var teams = GetAllTeamsAsync().GetAwaiter().GetResult(); var startTeams = teams; pilots.AllPilotsNoWorking(); navigators.AllNavigatorNoWorking(); var runway = runways.GetRunwayForRaceAsync().Result; var stageOne = runway.TrackLength / 4; var stageTwo = runway.TrackLength / 2; var stageThree = runway.TrackLength / 4; var data = GetStartDate().GetAwaiter().GetResult(); List <CompetitionsTeams> crashed = new List <CompetitionsTeams>(); string input = $"Бе дадено началото на състезанието {raceName}, провежащо се на дата: {data.ToString("D")} " + $"на писта {runway.Name}.";//ToDo raceHistory.AddHistory(input); input = "Очакваме всеки момент да потегли първият автомобил."; raceHistory.AddHistory(input); var count = teams.Count; CompetitiveStage(pilots, people, navigators, team, raceHistory, cars, teams, runway, count, crashed, stageOne, 1);//1 comes from the number of Stage - stageOne for (int j = 0; j < crashed.Count; j++) { teams.Remove(crashed[j]); } crashed = new List <CompetitionsTeams>(); input = $"В надпреварата продължават {teams.Count} автомобила. Нека видим как ще се развие състезанието."; raceHistory.AddHistory(input); count = teams.Count; CompetitiveStage(pilots, people, navigators, team, raceHistory, cars, teams, runway, count, crashed, stageTwo, 2);//2 comes from the number of Stage - stageTwo for (int j = 0; j < crashed.Count; j++) { teams.Remove(crashed[j]); } crashed = new List <CompetitionsTeams>(); input = $"В последния етап на надпреварата продължават {teams.Count} автомобила. Нека видим как ще се завърши състезанието."; raceHistory.AddHistory(input); ratingList.AddPontsSE(); count = teams.Count; CompetitiveStage(pilots, people, navigators, team, raceHistory, cars, teams, runway, count, crashed, stageThree, 3);//3 comes from the number of Stage - stageThree ratingList.AddPonts(); input = $"Състезанието {raceName} завърши. Нека погледнем крайните времена."; raceHistory.AddHistory(input); var dictionary = ratingList.GetRatingList(); foreach (var item in dictionary) { input = $"Отбор {item.Key.Name} завършва с време {item.Value.Minute}"; raceHistory.AddHistory(input); AddTime(item.Key.Name, item.Value); } input = $"До нови срещи приятели! Очаквам ви отново на следващото състезание."; raceHistory.AddHistory(input); var prizeFund = GetCompetitionPrizeFund().Result; var winners = ratingList.DistributionPoint(); money.DistributionOfPrizeMoney(prizeFund, startTeams, winners); raceHistory.CreateHistory(teams[0].CompetitionId, raceName); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed ActivateNextRace(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed }