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 ActionResult Create(PenaltyViewModel model) { if (ModelState.IsValid) { model.Penalty.League = leagueService.Get(model.LeagueId); model.Penalty.Team = teamService.Get(model.TeamId); penaltyService.Save(model.Penalty); penaltyService.Commit(); // Seems to have to be committed before updating points/stats UpdateTeamLeaguePenaltiesAndStats(model.LeagueId, model.TeamId); penaltyService.Commit(); SuccessMessage(FormMessages.SaveSuccess); return(RedirectToAction("Index")); } PopulateStaticData(model); return(View(model)); }
public async Task <IActionResult> Get(Guid id) { IActionResult result = await Execute(_log, async() => await _leagueService.Get(id)); return(result); }
public ActionResult Index() { List <League> leagueList = leagueService.Get(orderBy: q => q.OrderByDescending(l => l.Id)); return(View(leagueList)); }
public ActionResult View(int id) { League @league = leagueService.Get(id); return(View(@league)); }