public JsonResult Index(int value) { var random = new Random(); var randomNumbers = new RandomNumbers(); if (value != 0) { for (int i = 0; i < value; i++) { randomNumbers.Numbers.Add(random.Next(1, 100)); //randomNumbers.Numbers.Add(" "); //Thread.Sleep(1000); } } var numbers = new Numbers(randomNumbers); var jsonResult = new JsonResult() { Data = numbers, JsonRequestBehavior = JsonRequestBehavior.AllowGet, }; return Json(jsonResult.Data); //Numbers numbers = new Numbers(); //Random random = new Random(); //if (value != 0) //{ // for (int i = 0; i < value; i++) // { // numbers.randomNumbers.Numbers.Add(random.Next(1,100)); // Thread.Sleep(1000); // } //} //return View(numbers); //return Json(numbers, JsonRequestBehavior.AllowGet); }
public Numbers(RandomNumbers randomNumbers) { this.randomNumbers = randomNumbers; }