예제 #1
0
 public ActionResult UpdateMatch(int id, int homeTeamId, int awayTeamId, int homeTeamGoalsScored, int awayTeamGoalsScored)
 {
     ValidateData(homeTeamId, awayTeamId, homeTeamGoalsScored, awayTeamGoalsScored);
     if (ModelState.IsValid)
     {
         matchesService.EditMatch(id, homeTeamId, awayTeamId, homeTeamGoalsScored, awayTeamGoalsScored);
         pointsCalculator.CalculatePoints();
         return(RedirectToAction("Index"));
     }
     else
     {
         var teams = teamsService.GetTeamsViewModel();
         var model = matchesService.CreateNewModel(teams, id, homeTeamId, awayTeamId, homeTeamGoalsScored, awayTeamGoalsScored);
         return(View("AddMatch", model));
     }
 }