public int GetScore(int userInput) { int userScore = 0; if (userInput > 0 && userInput < 9) { int randomValue = randomNum.GetRandomNumber(); if (userInput == randomValue) { userScore = 10; } else { userScore = 0; } } return(userScore); }
public ActionResult CalculateUsingViewData() { var number1 = randomNumberService.GetRandomNumber(); var number2 = randomNumberService.GetRandomNumber(); var summ = calculateNumberService.Summ(number1, number2); var subtraction = calculateNumberService.Subtraction(number1, number2); var multiplication = calculateNumberService.Multiplication(number1, number2); var division = calculateNumberService.Division(number1, number2); this.ViewData["Number1"] = number1; this.ViewData["Number2"] = number2; this.ViewData["Summ"] = summ; this.ViewData["Subtraction"] = subtraction; this.ViewData["Multiplication"] = multiplication; this.ViewData["Division"] = division; return(this.View()); }