Пример #1
0
        //for Question drp
        public void GetQuestionForDrp()
        {
            ChoiceBL topicBL = new ChoiceBL();
            List <ChoiceEntities> pocoList = new List <ChoiceEntities>();

            pocoList = topicBL.GetQuestionForDrp();

            List <ChoiceEntities> itmasterList = new List <ChoiceEntities>();

            foreach (ChoiceEntities up in pocoList)
            {
                ChoiceEntities unt = new ChoiceEntities();
                unt.ID           = up.ID;
                unt.QuestionName = up.QuestionName;

                itmasterList.Add(unt);
            }

            ViewBag.QuestionForDrp = itmasterList.Select(x =>
                                                         new SelectListItem()
            {
                Text  = x.QuestionName,
                Value = x.ID.ToString()
            });
        }
Пример #2
0
        public ActionResult DeleteChoice(int ID, ref string oUTPUT)
        {
            ChoiceBL topicBL        = new ChoiceBL();
            int      recordaffected = topicBL.DeleteChoice(ID, ref oUTPUT);

            return(Json(recordaffected, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public JsonResult LoadData()
        {
            int draw, start, length;
            int pageIndex = 0;

            if (null != Request.Form.GetValues("draw"))
            {
                draw   = int.Parse(Request.Form.GetValues("draw").FirstOrDefault().ToString());
                start  = int.Parse(Request.Form.GetValues("start").FirstOrDefault().ToString());
                length = int.Parse(Request.Form.GetValues("length").FirstOrDefault().ToString());
            }
            else
            {
                draw   = 1;
                start  = 0;
                length = 50;
            }

            if (start == 0)
            {
                pageIndex = 1;
            }
            else
            {
                pageIndex = (start / length) + 1;
            }

            ChoiceBL topicBL      = new ChoiceBL();
            int      totalrecords = 0;

            List <ChoiceEntities> topicEntities = new List <ChoiceEntities>();

            topicEntities = topicBL.GetChoicePageWise(pageIndex, ref totalrecords, length);

            var data = topicEntities;

            return(Json(new { draw = draw, recordsFiltered = totalrecords, recordsTotal = totalrecords, data = data }, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        public ActionResult GetChoiceByID(int ID)
        {
            ChoiceBL topicBL = new ChoiceBL();

            return(Json(topicBL.GetChoiceByID(ID), JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public JsonResult Add(ChoiceEntities choiceEntities)
        {
            ChoiceBL topicBL = new ChoiceBL();

            return(Json(topicBL.SaveChoice(choiceEntities), JsonRequestBehavior.AllowGet));
        }