public ActionResult ListModIndex(string searchString, int page = 1, int pageSize = 5)
        {
            var dao   = new CredentialDao();
            var model = dao.ListMod(searchString, page, pageSize);

            return(View(model));
        }
예제 #2
0
        public ActionResult Index(string searchString, int page = 1, int pageSize = 20)
        {
            var dao   = new CredentialDao();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;

            return(View(model));
        }
예제 #3
0
        // GET: Admin/UserGroup
        public ActionResult Index()
        {
            var lstCredentialDao = new CredentialDao().listCredential();
            Dictionary <string, List <Credential> > item = lstCredentialDao.GroupBy(x => x.UserGroupID).ToDictionary(s => s.Key, x => x.ToList());

            ViewBag.ListCredential = item;
            ViewBag.Mod            = new CredentialDao().ListCredentialRoles("MOD");
            ViewBag.Admin          = new CredentialDao().ListCredentialRoles("ADMIN");
            ViewBag.Member         = new CredentialDao().ListCredentialRoles("MEMBER");
            return(View());
        }
예제 #4
0
        public ActionResult Index(string ID, Credential entity)
        {
            var credential = new Credential();

            credential.UserGroupID = ID;
            credential.RoleID      = entity.UserGroupID;
            var dao = new CredentialDao();

            var res = dao.Insert(credential);

            return(RedirectToAction("Index"));
        }
예제 #5
0
        public JsonResult LoadData(string userGroup, int pageIndex, int pageSize)
        {
            var model    = new CredentialDao().ListByUserGroup(userGroup);
            int totalRow = model.Count();

            model = model.OrderByDescending(x => x.RoleID)
                    .Skip((pageIndex - 1) * pageSize)
                    .Take(pageSize);
            int totalRowCurent = model.Count();

            return(Json(new
            {
                data = model,
                total = totalRow,
                totalCurent = totalRowCurent,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        public JsonResult Delete(string userGroupId, string roleId)
        {
            var res = new CredentialDao().Delete(userGroupId, roleId);

            if (res)
            {
                return(Json(new
                {
                    status = true
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new
                {
                    status = false
                }, JsonRequestBehavior.AllowGet));
            }
        }
 public ActionResult CreateMod(Credential Cre)
 {
     if (ModelState.IsValid)
     {
         var  dao = new CredentialDao();
         long id  = dao.InSert(Cre);
         if (id > 0)
         {
             SetAlert("Thêm Mod thành công", "success");
             return(Redirect("/Admin/AdminManage/ListModIndex"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm Mod không thành thành công");
         }
     }
     SetViewBagMod();
     return(View("ListModIndex"));
 }
예제 #8
0
        public ActionResult Create(Credential credential)
        {
            if (ModelState.IsValid)
            {
                var dao = new CredentialDao();

                //lấy id trong session đăng nhập của quản trị lưu vào phiên tạo mới user

                long id = dao.Insert(credential);
                if (id > 0)
                {
                    SetAlert("Phân quyền thành công", "success");
                    return(RedirectToAction("Index", "Credential"));
                }
                else
                {
                    ModelState.AddModelError("", "Phân quyền không thành công");
                }
            }
            SetViewBag();
            SetAlert("Error", "error");
            return(RedirectToAction("Index", "Credential"));
        }
예제 #9
0
        public void SetViewGroup(string selectedId = null)
        {
            var dao = new CredentialDao();

            ViewBag.UserGroupID = new SelectList(dao.ListAllGroup(), "GroupID", "Name", selectedId);
        }
예제 #10
0
        public void SetViewBag(string[] selectedlist = null)
        {
            var dao = new CredentialDao();

            ViewBag.SelectedIDRole = new MultiSelectList(dao.ListAll(), "ID", "Name", selectedlist);
        }
예제 #11
0
        public void SetDropdownList(string userGroupId, string selectedId = null)
        {
            var listRole = new CredentialDao().CheckRoleExist(userGroupId);

            ViewBag.UserGroupID = new SelectList(listRole, "ID", "Name", selectedId);
        }
        public void SetViewBagMod(long?selectedId = null)
        {
            var dao = new CredentialDao();

            ViewBag.RoleID = new SelectList(dao.ListAll(), "Name", "Name", selectedId);
        }