public void CanCreateLeagueWinner() { LeagueWinner cupWinner = new LeagueWinner(league, team); Assert.That(cupWinner.League.Id, Is.EqualTo(league.Id)); Assert.That(cupWinner.Team.Id, Is.EqualTo(team.Id)); }
public ActionResult Create(LeagueWinnerViewModel model) { if (ModelState.IsValid) { LeagueWinner leagueWinner = new LeagueWinner(leagueService.Get(model.LeagueId), teamService.Get(model.TeamId)); leagueWinnerService.Insert(leagueWinner); leagueWinnerService.Commit(); SuccessMessage(FormMessages.SaveSuccess); return RedirectToAction("Index"); } PopulateStaticData(model); return View(model); }
public void MapToModel(LeagueWinner leagueWinner) { LeagueWinnerId = leagueWinner.Id; LeagueId = leagueWinner.League.Id; TeamId = leagueWinner.Team.Id; }
public ActionResult Edit(LeagueWinner @leagueWinner) { if (ModelState.IsValid) { leagueWinnerService.Update(@leagueWinner); leagueWinnerService.Commit(); SuccessMessage(FormMessages.SaveSuccess); return RedirectToAction("Index"); } return View(@leagueWinner); }