Exemple #1
0
        public ActionResult DisplayPartialResults(DisplayResultViewModel displayResultModel)
        {
            if (ModelState.IsValid)
            {
                @ViewBag.Year = displayResultModel.Year;
                displayResultModel.NbTimes++;
                CDisplayResults.DisplayNextResult(displayResultModel, GetResults(displayResultModel.Year, false), GetResults(displayResultModel.Year, true));

                ModelState.Clear();
                return(PartialView("_displayResults", displayResultModel));
            }
            return(PartialView("_displayResults", new DisplayResultViewModel(displayResultModel.Year, 1)));
        }
Exemple #2
0
        public static bool DisplayNextResult(DisplayResultViewModel model, List <ResultModel> results,
                                             List <ResultModel> resultsForMoney)
        {
            if (model.NbTimes <= 0)
            {
                model.NbTimes = 1;
            }


            if (results == null)
            {
                return(false);
            }

            if (model.NbTimes <= 8)
            {
                if (model.NbTimes >= 1) // Prix citron
                {
                    model.LabelCitron = FormatPrixCitron(results);
                }
                if (model.NbTimes >= 2) // 5eme position
                {
                    model.LabelFifth = FormatResults(resultsForMoney, 5);
                    if (string.IsNullOrEmpty(model.LabelFifth) && model.NbTimes == 2)
                    {
                        model.NbTimes++;
                    }
                }
                if (model.NbTimes >= 3) // 4eme position
                {
                    model.LabelFourth = FormatResults(resultsForMoney, 4);
                    if (string.IsNullOrEmpty(model.LabelFourth) && model.NbTimes == 3)
                    {
                        model.NbTimes++;
                    }
                }
                if (model.NbTimes >= 4) // 3eme position
                {
                    model.LabelThird = FormatResults(resultsForMoney, 3);
                    if (string.IsNullOrEmpty(model.LabelThird) && model.NbTimes == 4)
                    {
                        model.NbTimes++;
                    }
                }
                if (model.NbTimes >= 5) // 2eme position
                {
                    model.LabelSecond = FormatResults(resultsForMoney, 2);
                    if (string.IsNullOrEmpty(model.LabelSecond) && model.NbTimes == 5)
                    {
                        model.NbTimes++;
                    }
                }
                if (model.NbTimes >= 6) // 1ere position
                {
                    model.LabelFirst = FormatResults(resultsForMoney, 1);
                    if (string.IsNullOrEmpty(model.LabelFirst) && model.NbTimes == 6)
                    {
                        model.NbTimes++;
                    }
                }
                if (model.NbTimes >= 7) // Trophée Jojoscar
                {
                    model.LabelTropheeJojoscar = FormatResultTrophee(results);
                }
                if (model.NbTimes >= 8) // Tableau des résultats
                {
                    model.Results = resultsForMoney;
                }
            }
            else
            {
                model.NbTimes = 0;
            }
            return(true);
        }