Exemplo n.º 1
0
        public ActionResult EditTeam4x4(EditTeam4x4ViewModel vm)
        {
            var match = DocumentSession.Load<Match4x4>(vm.Id);
            if (match == null)
                throw new HttpException(404, "Match not found");

            if (vm.IsHomeTeam)
                match.HomeTeam = vm.Team.MapTo<Team4x4>();
            else
                match.AwayTeam = vm.Team.MapTo<Team4x4>();

            return RedirectToAction("Details4x4", new { id = vm.Id });
        }
Exemplo n.º 2
0
        public ActionResult EditTeam4x4(int id, bool isHomeTeam)
        {
            var match = DocumentSession.Load<Match4x4>(id);
            if (match == null)
                throw new HttpException(404, "Match not found");

            var teamViewModel = isHomeTeam
                ? match.HomeTeam.MapTo<Team4x4ViewModel>()
                : match.AwayTeam.MapTo<Team4x4ViewModel>();
            var vm = new EditTeam4x4ViewModel
            {
                Id = id,
                IsHomeTeam = isHomeTeam,
                Team = teamViewModel
            };

            return View(vm);
        }