public void Execute(IDocumentSession session, IEventStoreSession eventStoreSession)
        {
            var matchResult = new MatchResult4(
                roster,
                result.TeamScore,
                result.OpponentScore,
                roster.BitsMatchId);
            var series = new[]
            {
                result.Series.ElementAtOrDefault(0),
                result.Series.ElementAtOrDefault(1),
                result.Series.ElementAtOrDefault(2),
                result.Series.ElementAtOrDefault(3)
            };
            foreach (var serie in series.Where(x => x != null))
            {
                var games = new List<MatchGame4>();
                for (var i = 0; i < 4; i++)
                {
                    var game = serie.Games[i];
                    var matchGame = new MatchGame4(game.Player, game.Score, game.Pins);
                    games.Add(matchGame);
                }

                matchResult.RegisterSerie(new MatchSerie4(games));
            }

            eventStoreSession.Store(matchResult);
        }
        public ActionResult RegisterBitsVerifyConfirmed4(RegisterBitsResult4 vm)
        {
            if (ModelState.IsValid == false) return View(vm);

            var roster = DocumentSession.Load<Roster>(vm.RosterId);
            if (roster == null)
                throw new HttpException(404, "Roster not found");

            var matchResult = new MatchResult4(
                roster,
                vm.TeamScore,
                vm.OpponentScore,
                vm.BitsMatchId);
            foreach (var serie in new[] { vm.Serie1, vm.Serie2, vm.Serie3, vm.Serie4 }.Where(x => x != null))
            {
                var games = new List<MatchGame4>();
                for (var i = 0; i < 4; i++)
                {
                    var game = new MatchGame4(
                        serie.Games[i].Player,
                        serie.Games[i].Score,
                        serie.Games[i].Pins);
                    games.Add(game);
                }

                matchResult.RegisterSerie(new MatchSerie4(games));
            }

            EventStoreSession.Store(matchResult);

            return RedirectToAction("Index", "MatchResult");
        }
 public void AddGame(MatchGame4 game)
 {
     TotalSeries++;
     TotalPins += game.Pins;
 }