public CupLeague(Cup cup, League league)
            : this()
        {
            Check.Require(cup != null, "cup must be provided");
            Check.Require(league != null, "league must be provided");

            League = league;
            Cup = cup;
        }
 public ClassWithTreeMatchingPropertiesCupTeamPlayer(Penalty penalty, int crappys, float felix, Cup cup, Team team, Player player)
 {
     this.Penalty = penalty;
     this.Crappys = crappys;
     this.felix = felix;
     this.Cup = cup;
     this.Team = team;
     this.Player = player;
 }
 public ActionResult Edit(Cup @cup)
 {
     if (ModelState.IsValid) {
                 cupService.Update(@cup);
                 cupService.Commit();
                 SuccessMessage(FormMessages.SaveSuccess);
                 return RedirectToAction("Index");
         }
         return View(@cup);
 }
        public CupWinner(Season season, Cup cup, Team team)
            : this()
        {
            Check.Require(season != null, "season must be provided");
            Check.Require(cup    != null, "cup must be provided");
            Check.Require(team   != null, "team must be provided");

            this.Season = season;
            this.Cup    = cup;
            this.Team   = team;
        }
        public void CanCreateCupLeague()
        {
            Cup cup = new Cup("Handicap Cup");
            League league = new League(new Season(2008, 2009), "League 1", 1, 1);

            CupLeague cupLeague = new CupLeague(cup, league);

            Assert.That(cupLeague.Cup.CupName, Is.EqualTo(cup.CupName));
            Assert.That(cupLeague.League.Season.StartYear == 2008);
            Assert.That(cupLeague.League.Season.EndYear == 2009);
            Assert.That(cupLeague.League.LeagueDescription == league.LeagueDescription);
        }
        public PlayerCupStats(Player player,
            Cup cup,
            Season season,
            int totalPoints,
            int totalFouls,
            int gamesPlayed,
            int mvpAwards)
            : this()
        {
            // Check for required values
            Check.Require(player != null, "player must be provided");
            Check.Require(cup    != null, "cup must be provided");
            Check.Require(season != null, "season must be provided");

            this.Season = season;
            this.Cup    = cup;
            this.Player = player;

            UpdateStats(totalPoints, totalFouls, gamesPlayed, mvpAwards);
        }
 public void UpdatePlayerCupStats(List<PlayerFixture> playerFixtures, Cup cup, Season season)
 {
     foreach (PlayerFixture pf in playerFixtures)
         UpdatePlayerCupStats(pf, cup, season);
 }
        public PlayerCupStats UpdatePlayerCupStats(PlayerFixture playerFixture, Cup cup, Season season)
        {
            PlayerCupStats playerCupStats;

            // Get all PlayerFixture records for specified season
            List<PlayerFixture> playerFixturesForCup = statsReportingService.GetPlayerFixtureStatsForCupAndSeason(playerFixture.Player.Id, cup.Id, season.Id).ToList();

            // Total stats
            int totalPoints = playerFixturesForCup.Sum(pf => pf.PointsScored);
            int totalFouls = playerFixturesForCup.Sum(pf => pf.Fouls);
            int mvpAwards = playerFixturesForCup.Count(pf => pf.IsMvp == "Y");

            // Find existing record
            playerCupStats = statsReportingService.GetPlayerCupStats(playerFixture.Player.Id, cup.Id, season.Id);

            // If doesn't exist, create new
            if (playerCupStats == null)
                playerCupStats = new PlayerCupStats(playerFixture.Player, cup, season, totalPoints, totalFouls, playerFixturesForCup.Count, mvpAwards);
            else
            {
                // Update values
                playerCupStats.UpdateStats(totalPoints, totalFouls, playerFixturesForCup.Count, mvpAwards);
            }

            // Save
            matchResultRepository.SavePlayerCupStats(playerCupStats);

            return playerCupStats;
        }
 public CupWinnerTests()
 {
     season = new Season(2008, 2009);
     cup = new Cup("My Cup");
     team = new Team("Velocity", "Nunthorpe Velocity");
 }
 public static Cup CreateCup(int id)
 {
     Cup cup = new Cup("Cup Name");
     EntityIdSetter.SetIdOf(cup, id);
     return cup;
 }