public IActionResult ShowGameCode() { ShowCodeForNewGameVM showCodeForNewGameVM = new ShowCodeForNewGameVM { NameOfQuiz = TempData["NameOfQuiz"] as string, GameCode = TempData["GameCode"] as string }; return(View(nameof(ShowCodeForNewGame), showCodeForNewGameVM)); }
public IActionResult ShowCodeForNewGame(ShowCodeForNewGameVM showCodeForNewGameVM) { var guid = Guid.NewGuid().ToString().ToUpper(); guid = guid.Substring(0, 4); showCodeForNewGameVM.GameCode = guid; repository.SaveNewGame(new NewGame { GameCodeId = showCodeForNewGameVM.GameCode, QuizId = showCodeForNewGameVM.QuizId, ShowAnswersToPlayer = showCodeForNewGameVM.ShowAnswers, TimeStamp = DateTime.Now }); TempData["NameOfQuiz"] = showCodeForNewGameVM.NameOfQuiz; TempData["GameCode"] = showCodeForNewGameVM.GameCode; return(RedirectToAction(nameof(ShowGameCode))); }