public IActionResult AddMatch(MatchAdminFormViewModel model) { if (!ModelState.IsValid) { model.Teams = GetSelectListItemTeams(model.LeagueId); return(View(model)); } bool roundExists = matchAdminService.RoundExists(model.RoundId); if (!roundExists) { return(NotFound()); } this.matchAdminService.Create(model.HomeTeam, model.AwayTeam, model.HomeWinPoints, model.AwayWinPoints, model.DrawPoints, model.MatchStart, model.Result, model.RoundId, model.LeagueId); this.TempData.AddSuccessMessage(MessageResources.msgSuccessfullyAdded); return(RedirectToAction(nameof(All), new { roundId = model.RoundId })); }
public IActionResult EditMatch(int matchId, MatchAdminFormViewModel model) { if (!ModelState.IsValid) { model.Teams = GetSelectListItemTeams(model.LeagueId); return(View(model)); } this.matchAdminService.Edit(matchId, model.HomeTeam, model.AwayTeam, model.HomeWinPoints, model.AwayWinPoints, model.DrawPoints, model.MatchStart, model.Result); this.TempData.AddSuccessMessage(MessageResources.msgSuccessfullyEdited); return(RedirectToAction(nameof(All), new { roundId = model.RoundId })); }