public ActionResult EditTeam8x4(EditTeam8x4ViewModel vm) { var match = DocumentSession.Load<Match8x4>(vm.Id); if (match == null) throw new HttpException(404, "Match not found"); if (vm.IsHomeTeam) match.HomeTeam = vm.Team.MapTo<HomeTeamFactory>().CreateTeam(); else match.AwayTeam = vm.Team.MapTo<AwayTeamFactory>().CreateTeam(); return RedirectToAction("Details8x4", new { id = vm.Id }); }
public ActionResult EditTeam8x4(int id, bool isHomeTeam) { var match = DocumentSession.Load<Match8x4>(id); if (match == null) throw new HttpException(404, "Match not found"); var teamViewModel = isHomeTeam ? match.HomeTeam.MapTo<Team8x4ViewModel>() : match.AwayTeam.MapTo<Team8x4ViewModel>(); var vm = new EditTeam8x4ViewModel { Id = id, IsHomeTeam = isHomeTeam, Team = teamViewModel }; return View(vm); }