Beispiel #1
0
        public JsonResult getServerGrid()
        {
            string            theName  = Request["theName"].ToString();
            int               start    = int.Parse(Request["start"].ToString());
            int               limit    = int.Parse(Request["limit"].ToString());
            List <Model_10_5> list     = new List <Model_10_5>();
            Model_10_5        theModel = new Model_10_5();

            theModel.id     = 0;
            theModel.title  = "ABC";
            theModel.artist = "abc";
            theModel.rate   = 100;
            list.Add(theModel);
            for (int i = 0; i < 20; i++)
            {
                Model_10_5 theModel_10_5 = new Model_10_5();
                theModel_10_5.id     = i + 1;
                theModel_10_5.title  = RadomChar.GetRandomString(3, 5, true);
                theModel_10_5.artist = RadomChar.GetRandomString(3, 10, true);
                theModel_10_5.rate   = RadomChar.GetRandomint(1, 100);
                theModel_10_5.price  = RadomChar.GetRandomint(1, 100) * 0.25;
                theModel_10_5.date   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                list.Add(theModel_10_5);
            }
            if (!String.IsNullOrWhiteSpace(theName))
            {
                var svb = (from a in list where a.title == theName select a).ToList();
                if (svb.Count > 0)
                {
                    list = svb;
                    return(Json(new { count = list.Count, data = list }));
                }
            }
            return(Json(new { count = list.Count, data = list.Skip(start).Take(limit).ToList() }));
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            for (int i = 0; i < 11; i++)
            {
                Console.WriteLine(RadomChar.GetRandomint(1, 100).ToString());
                //Console.WriteLine(RadomChar.GetRandomString(3, 10, true));
            }

            Console.ReadKey();
        }