Ejemplo n.º 1
0
        public IActionResult CatVoting(int idxCat = 0)
        {
            var catCandidates = _catService.GetCatCandidates();

            var catVotingViewModel = new CatVotingViewModel();

            // a mettre dans le service
            if (idxCat == 0)
            {
                var random = new Random();
                idxCat = random.Next(0, 97);
            }

            // idem : creer 1 fct GetCat(idx) dans le service
            catVotingViewModel.CatCandidateLeft = (catCandidates.ToArray().ElementAt(idxCat));
            idxCat = idxCat + 1;
            catVotingViewModel.CatCandidateRight = (catCandidates.ToArray().ElementAt(idxCat));
            catVotingViewModel.IdxCat            = idxCat;

            return(View(catVotingViewModel));
        }
Ejemplo n.º 2
0
        public IActionResult UpdateCatScore(CatVotingViewModel catVotingViewModel)
        {
            var catCandidates = _catService.UpdateCatScore(catVotingViewModel.CatIdSelected);

            return(RedirectToAction("CatVoting"));
        }