public ActionResult Index() { PlayerStorage playerStorage = new PlayerStorage(); var model = new MainPageViewModel(); //model.Players = playerStorage.GetPlayersByAgeinterval(20, 25); TeamDataStorage teamDataStorage = new TeamDataStorage(); Player player = new Player { Name = "Рафаэль Варан", Age = 21, Atack = 35, Defence = 80, Position = "защитник", Price = 20000 }; //playerStorage.AddPlayer(player); TeamData teamData = new TeamData { Budget = 100000, Rate = 10, PlayersNumber = 11, MatchesPlayed = 20, MatchesWin = 10, MatchesDraw = 7, MatchesLose = 3 }; teamDataStorage.AddTeamData(teamData); //model.teamData = teamDataStorage.GetTeamData(0); return View(model); }
public void AddPlayer(Player player) { Player currentPlayer = playerStorage.GetPlayerByName(player.Name); if (currentPlayer != null) throw new Exception("Такой игрок уже есть"); playerStorage.AddPlayer(player); }