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)); }
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)); }
// 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()); }
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")); }
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)); }
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")); }
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")); }
public void SetViewGroup(string selectedId = null) { var dao = new CredentialDao(); ViewBag.UserGroupID = new SelectList(dao.ListAllGroup(), "GroupID", "Name", selectedId); }
public void SetViewBag(string[] selectedlist = null) { var dao = new CredentialDao(); ViewBag.SelectedIDRole = new MultiSelectList(dao.ListAll(), "ID", "Name", selectedlist); }
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); }