Exemplo n.º 1
0
 public ActionResult AddMatchToDB(int homeTeamId, int awayTeamId, int homeTeamGoalsScored, int awayTeamGoalsScored)
 {
     ValidateData(homeTeamId, awayTeamId, homeTeamGoalsScored, awayTeamGoalsScored);
     if (ModelState.IsValid)
     {
         matchesService.AddNewMatchToDB(homeTeamId, awayTeamId, homeTeamGoalsScored, awayTeamGoalsScored);
         pointsCalculator.CalculatePoints();
         return(RedirectToAction("Index"));
     }
     else
     {
         var teams = teamsService.GetTeamsViewModel();
         var model = matchesService.CreateNewModel(teams);
         return(View("AddMatch", model));
     }
 }