public void AddTeamData(TeamData teamData) { TeamData currentTeamData = teamDataStorage.GetTeamData(teamData.Id); if (currentTeamData != null) throw new Exception("Такая команда уже есть"); teamDataStorage.AddTeamData(teamData); }
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 UpdateTeamData(int teamId, TeamData teamData) { TeamData currentTeamData = GetTeamData(teamId); currentTeamData = teamData; currentContext.SaveChanges(); }
public void DeleteTeamData(TeamData teamData) { currentContext.TeamDatas.Remove(teamData); currentContext.SaveChanges(); }
public void AddTeamData(TeamData teamData) { currentContext.TeamDatas.Add(teamData); currentContext.SaveChanges(); }