コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Numbers.cs プロジェクト: MartinaMagnusson/knockout
 public Numbers(RandomNumbers randomNumbers)
 {
     this.randomNumbers = randomNumbers;
 }