public PredictionsController(IGamblersService gamblers, IPredictionsService predictions, IGamesService games, IPlayersService players) { this.gamblers = gamblers; this.predictions = predictions; this.games = games; this.players = players; }
public GamesController(ITeamsService teams, IGamesService games, IPlayersService players, IPredictionsService predictions, IGamblersService gamblers) { this.teams = teams; this.games = games; this.players = players; this.predictions = predictions; this.gamblers = gamblers; }
public HomeController(IGamesService games, IGamblersService gamblers, IPredictionsService predictions) { this.games = games; this.gamblers = gamblers; this.predictions = predictions; }
public GamblersController(IGamblersService gamblers, IGamesService games) { this.gamblers = gamblers; this.games = games; }
public static void CheckCorrectPredictions(UpdateFinishedGameViewModel model, IPredictionsService predictions, IGamblersService gamblers) { var realFinalResult = model.FinalResult.Split(new char[] { ':', '-' }).ToArray(); var homeTeamGoals = int.Parse(realFinalResult[0]); var guestTeamGoals = int.Parse(realFinalResult[1]); var currentGamePredictions = predictions.GetAll().Where(p => p.GameId == model.Id).ToList(); foreach (var prediction in currentGamePredictions) { currentPredictionPoints = 0; var finalResult = prediction.FinalResult.Split(new char[] { ':', '-' }).ToArray(); var homeTeamGoalsPrediction = int.Parse(finalResult[0]); var guestTeamGoalsPrediction = int.Parse(finalResult[1]); var updatedPrediction = new UpdatePredictionPointsViewModel(); updatedPrediction.FinalResultPredicted = CheckIfResultIsCorrectlyPredicted(homeTeamGoals, guestTeamGoals, homeTeamGoalsPrediction, guestTeamGoalsPrediction); if (!updatedPrediction.FinalResultPredicted) { updatedPrediction.SignPredicted = CheckIfSignIsCorrectlyPredicted(homeTeamGoals, guestTeamGoals, homeTeamGoalsPrediction, guestTeamGoalsPrediction); } else { updatedPrediction.SignPredicted = true; } var goalscorerPredictionPoints = CheckCorrectGoalscorer(model, prediction.Goalscorer); currentPredictionPoints += goalscorerPredictionPoints; if (goalscorerPredictionPoints > 0) { updatedPrediction.GoalscorerPredicted = true; } var currentPrediction = predictions.GetById(prediction.Id).FirstOrDefault(); updatedPrediction.TotalPoints = currentPredictionPoints; var dataModel = AutoMapper.Mapper.Map <UpdatePredictionPointsViewModel, LesGamblers.Models.Prediction>(updatedPrediction); predictions.UpdatePrediction(dataModel, prediction.Id); } }