public ActionResult SaveScore(string PlayMode, int Min, int Max, int numRight, int numWrong, int seconds, int rank) { SelectPlayModel playModel = new SelectPlayModel(String.Format("{0}|{1}|{2}", PlayMode, Min, Max)); FullPlayModel fullModel = new FullPlayModel(playModel); return Json(fullModel.PlayValues); }
public ActionResult LoadPlay(string PlayMode, int Min, int Max) { SelectPlayModel playModel = new SelectPlayModel(String.Format("{0}|{1}|{2}", PlayMode, Min, Max)); FullPlayModel fullModel = new FullPlayModel(playModel); return Json(fullModel.PlayValues); }
// // GET: /Play/ public ActionResult Index(SelectPlayModel selectedModel) { ViewBag.Message = "Play Azure Math!"; ViewBag.HomeClass = "unselected"; ViewBag.PlayClass = "selected"; ViewBag.RegisterClass = "unselected"; return View(selectedModel); }
public ActionResult Select(SelectPlayModel model) { if (ModelState.IsValid) { return this.RedirectToAction("Index"); //return this.RedirectToAction(c => c.Index(model)); } // If we got this far, something failed, redisplay form return View(model); }
private List<PlayValue> GeneratePlayValues(SelectPlayModel selectModel) { List<PlayValue> playValues = new List<PlayValue>(); for (int n = 0; n <= 200; n++) { int result = 0; int first = GetRandomIntegerBetween((n*3), 1, selectModel.Min); int second = GetRandomIntegerBetween((n*7), 1, selectModel.Max); switch (SelectPlayModel.PlayMode) { case "Bonds": { result = first + second; int alt = n%2; if (alt == 0) playValues.Add(new PlayValue(result, first, second, "-")); else playValues.Add(new PlayValue(first, second, result, "+")); break; } case "Multiply": { result = first*second; playValues.Add(new PlayValue(first, second, result, "×")); break; } case "Divide": { result = first*second; playValues.Add(new PlayValue(result, first, second, "÷")); break; } } } return playValues; }
public FullPlayModel(SelectPlayModel selectModel) { _selectPlayModel = selectModel; Initialise(); }