public ActionResult Index(QuestionCategoryViewhelper questionCategoryViewhelper)
 {
     if (Session.getCurrentUser() == null)
         return Redirect("/admin/account/logon");
     if (!SercurityServices.HasPermission((int)TypeModule.MODULE_HOIDAP, Session.getCurrentUser().username, TypeAudit.QuestionCategory))
     {
         return Redirect("/admin/error/error403");
     }
     saveData(questionCategoryViewhelper);
     return View();
 }
 public void setSearchFilter(QuestionCategoryServices QuestionCategoryServices, QuestionCategoryViewhelper QuestionCategoryViewhelper)
 {
     if (!String.IsNullOrWhiteSpace(QuestionCategoryViewhelper.KeySearch))
         QuestionCategoryServices.KeySearch = QuestionCategoryViewhelper.KeySearch;
 }
        public QuestionCategoryViewhelper saveData(QuestionCategoryViewhelper questionCategoryViewhelper)
        {
            QuestionCategoryServices questionCategoryServices = new QuestionCategoryServices();
            setSearchFilter(questionCategoryServices, questionCategoryViewhelper);

            int totalCount = questionCategoryServices.totalCount();
            questionCategoryViewhelper.TotalCount = totalCount;

            if (questionCategoryViewhelper.TotalCount > 0)
            {
                int totalPage = pageCalculation(totalCount, Constant.limit);
                questionCategoryViewhelper.TotalPage = totalPage;
                questionCategoryViewhelper.Page = pageTransition(questionCategoryViewhelper.Direction, questionCategoryViewhelper.Page, totalPage);
                questionCategoryViewhelper.FirstPage = fistPageCalculation(Constant.maxPageLine, totalPage, questionCategoryViewhelper.Page);
                questionCategoryViewhelper.LastPage = lastPageCalculation(Constant.maxPageLine, totalPage, questionCategoryViewhelper.Page, questionCategoryViewhelper.FirstPage);
                questionCategoryServices.addOrderBy("order_number", "ASC");
                List<QuestionCategoryModels> lstQuestionCategory = questionCategoryServices.select(questionCategoryViewhelper.Page, Constant.limit);
                questionCategoryViewhelper.LstQuestionCategory = lstQuestionCategory;
            }
            ViewData["questionCategoryViewhelper"] = questionCategoryViewhelper;
            return questionCategoryViewhelper;
        }