Пример #1
0
        public JsonResult ListQuestionExam(string groupcode)
        {
            QUESTION_BUS     bus  = new QUESTION_BUS();
            List <fieldpara> lipa = new List <fieldpara>
            {
                new fieldpara("QUESTIONGROUPCODE", groupcode, 0)
            };
            //order by theorder, with pagesize and the page
            List <QUESTION_OBJ> data = bus.getAllBy("CODEVIEW", lipa.ToArray());
            // tất cả các bản ghi
            List <QUESTION_OBJ> totalData = bus.getAllBy2("CODEVIEW", lipa.ToArray());

            int totalItem = totalData.Count;

            bus.CloseConnection();
            //Chỉ số đầu tiên của trang hiện tại (đã trừ -1)

            //Trả về client
            var    a             = JsonConvert.SerializeObject(data);
            string firstquestion = "";

            if (data.Count != 0)
            {
                firstquestion = JsonConvert.SerializeObject(data[0]);
            }
            var jsonResult = Json(new
            {
                firstquestion,
                data,      //Danh sách
                data2 = a,
                totalItem, //số lượng bản ghi
                ret = 0    //ok
            }, JsonRequestBehavior.AllowGet);

            jsonResult.MaxJsonLength = int.MaxValue;
            return(jsonResult);
        }