public IActionResult CheckAnswer(string[] answer, int[] bet) { Answer.IsValidate = true; var getQuest = _questionData.SelectQuestion(AnswerViewModel.ID); int BetMoney = 0; foreach (var x in bet) { BetMoney += x; } if (BetMoney != Player.Amount) { Answer.IsValidate = false; return(RedirectToAction("SelectedQuestion", new { id = AnswerViewModel.ID })); } var checkAnswer = _questionData.CheckAnswer(getQuest.CorrectAnswer, answer, bet); if (checkAnswer == true) { if (Player.AnswerNumber == 8) { return(RedirectToAction("FinalResult")); } else { Player.AnswerNumber++; return(View(getQuest)); } } else { TempData["ans"] = getQuest.CorrectAnswer; QuestLvl = 0; _questionData.ResetDatas(); return(RedirectToAction("BadAnswer")); } return(Ok()); }
public IActionResult EndWithoutScore() { _questionData.ResetDatas(); _playerData.ResetData(); return(RedirectToAction("Index")); }