public ActionResult Index(int?page) { int pageNumber = (page ?? 1); IList <Account298> tags = _account298Repository.GetAll().OrderByDescending(o => o.Username).ToList(); var data = tags.ToPagedList(pageNumber, pageSize); return(View("Index", data)); }
public ActionResult Index() { //co quyen moi duoc xem if (!CheckRole(_httpContext, int.Parse(Roles.Phan_Quyen_View))) { return(View("_NoAuthor")); } ShopUser userLogin = _httpContext.User.GetShopUser(); IList <Account298> account298s = _account298Repository.GetAll().ToList(); IList <PhanQuyenModel.QuyenModel> models = new List <PhanQuyenModel.QuyenModel>(); IList <RoleList> roles = Roles.GetRoles(); if (account298s.Any()) { foreach (var account298 in account298s) { //cat tu chuoi sang list int IList <int> ids = !string.IsNullOrEmpty(account298.Roles) ? account298.Roles.Split(',').Select(o => Convert.ToInt32(o)).ToList() : new List <int>(); IList <RoleList> QuyenUsers = (from roleList in roles where ids.Contains(roleList.Id) select roleList).ToList(); IList <string> tens = QuyenUsers.Select(o => o.Name).ToList(); models.Add(new PhanQuyenModel.QuyenModel() { NhanVienId = account298.id_, TenNhanVien = account298.Fullname, Quyen = string.Join(",", tens) }); } } return(View(models)); }